參考博客Linux學習之CentOShtml
這個地方記得受權就好mysql
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '1994713' WITH GRANT OPTION;
修改配置文件my.cnfsql
[root[@localhost](https://my.oschina.net/u/570656) /]# vim /etc/my.cnf
修改配置文件爲vim
~ "/etc/my.cnf[client]" [New] 6L, 94C written [root@localhost /]# vim /etc/my.cnf [mysqld] datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock user=mysql # Disabling symbolic-links is recommended to prevent assorted security risks symbolic-links=0 [mysqld_safe] log-error=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld.pid [client] default-character-set=utf8 [mysql] default-character-set=utf8 [mysqld] default-character-set=utf8