设为首页 - 加入收藏 华夏网 ()- 云主机,资讯,互联网,人工智能,云计算,大赢家论坛,区块链,VR,站长网!
热搜: 平台 google 2019 中国
当前位置: 主页 > 水果奶奶论坛 > 正文

travis mysql数据库创建用户错误

发布时间:2021-03-31 15:22 所属栏目:[水果奶奶论坛] 来源:网络整理
导读:我想为我的spring-boot项目设置travis,我使用用户makler / makler来访问数据库.运行travis时出现错误说: $mysql -u root -e 'CREATE DATABASE stockmarket;'$mysql -u root -e 'CREATE USER 'makler'@'localhost' IDENTIFIED BY 'makler';'ERROR 1064 (4200

我想为我的spring-boot项目设置travis,我使用用户makler / makler来访问数据库.运行travis时出现错误说:

$mysql -u root -e 'CREATE DATABASE stockmarket;'

$mysql -u root -e 'CREATE USER 'makler'@'localhost' IDENTIFIED BY 'makler';'
ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'makler' at line 1


The command "mysql -u root -e 'CREATE USER 'makler'@'localhost' IDENTIFIED BY 'makler';'" failed and exited with 1 during .

Your build has been stopped.

我的travis.yml文件看起来像:

language: java
jdk:
  - oraclejdk8
services:
  - mysql
dist: trusty
sudo: required
addons:
  apt:
    packages:
    - mysql-server-5.6
    - mysql-client-core-5.6
    - mysql-client-5.6
before_script:
  - mysql -u root -e 'CREATE DATABASE stockmarket;'
  - mysql -u root -e 'CREATE USER 'makler'@'localhost' IDENTIFIED BY 'makler';'
  - mysql -u root -e 'GRANT ALL ON stockmarket.* TO 'makler'@'localhost';'
最佳答案 它是查询周围的引号.使用双引号(“)而不是单引号(‘)更新您的before_script以包围查询

before_script:
- mysql -u root -e 'CREATE DATABASE stockmarket;'
- mysql -u root -e "CREATE USER 'makler'@'localhost' IDENTIFIED BY 'makler';"
- mysql -u root -e "GRANT ALL ON stockmarket.* TO 'makler'@'localhost';"

在我更改它并在travis上运行构建之后,构建工作正常.希望这可以帮助.

【免责声明】本站内容转载自互联网,其相关言论仅代表作者个人观点绝非权威,不代表本站立场。如您发现内容存在版权问题,请提交相关链接至邮箱:bqsm@foxmail.com,我们将及时予以处理。

网友评论
推荐文章