travis mysql数据库创建用户错误

前端之家收集整理的这篇文章主要介绍了travis mysql数据库创建用户错误前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

我想为我的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上运行构建之后,构建工作正常.希望这可以帮助.

原文链接:https://www.f2er.com/mysql/433525.html

猜你在找的MySQL相关文章