在CentOS 7 64位上出现错误1064(4200)MySQL

时间:2018-12-02 03:31:28

标签: mysql centos7 mysql-error-1064

背景:我正在研究一个有关分布式数据库的学校项目,并且我将通过在Workstation Pro上虚拟2个CentOS使用主从复制的概念。我正在浏览YouTube上的指南以及其他指南,但主要是从here获得的,我已经在两个VM上成功安装了MySQL,并创建了一个名为“ bedrock”的虚拟数据库并创建了一个表并填充它。我还使用这些语句创建了一个用户(创建数据库时,我使用mysql -u root -p的根目录时所做的所有事情):

CREATE USER 'bedrockuser'@'localhost' IDENTIFIED BY 'IT440!abcd';
GRANT ALL ON bedrock.* TO 'bedrockuser'@'localhost';
flush privileges;

我还根据此指南配置了my.cnf文件,但奇怪的是,当我使用此命令时,my.cnf文件中没有任何内容:

sudo nano /etc/mysql/my.cnf,但是如果我执行sudo nano /etc/my.cnf,我可以在my.cnf文件中看到这些文件,并根据指南在其中添加了内容:

[mysqld]
bind-address=12.34.56.789
server-id=1
binlog-do-db=bedrock
log-bin=/var/log/mysql/mysql-bin.log
user=mysql

symbolic-links=0
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
#
# Remove the leading "# " to disable binary logging
# Binary logging captures changes between backups and is enabled by
# default. It's default setting is log_bin=binlog
# disable_log_bin
#
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
#
# Remove leading # to revert to previous value for default_authentication_plugin,
# this will increase compatibility with older clients. For background, see:
# https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_default_authentication_plugin
# default-authentication-plugin=mysql_native_password

datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

然后我执行sudo service mysql restart,这就是我得到的:

Redirecting to /bin/systemctl restart mysql.service
Failed to restart mysql.service: Unit not found.

但是我没有停在那儿,我一直遵循指南,下一步是执行:

GRANT REPLICATION SLAVE ON *.* TO 'bedrockuser'@'%' IDENTIFIED BY 'IT440!abcd';

没有运气,这就是我得到的:

ERROR 1064 (42000): 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 'IDENTIFIED BY 'IT440!abcd'' at line 1

我不知道我做错了哪一部分,如果具有这一领域经验的人可以帮助解决我的问题,那将是非常棒的。这是我第一次使用Professor的0指南创建一个分布式数据库,所以在你们让我大吃一惊之前,请记住我只是一个尽力而为的大学生。谢谢

0 个答案:

没有答案