linux中yum安装mysql方式
安装mysql
yum install -y wget
wget https://repo.mysql.com//mysql80-community-release-el7-6.noarch.rpm
rpm -ivh mysql80-community-release-el7-6.noarch.rpm
# 下面这行报错
yum install -y mysql-server
# 解决办法
vim /etc/yum.repos.d/mysql-community.repo
将gpgcheck均修改为0
# systemctl start/status/restart/stop/enable/disable mysqld
启动mysql服务
systemctl start mysqld
登录MYSQL
[root@node1 ~]# grep "password" /var/log/mysqld.log
mysql -uroot -p密码
开机自启动
systemctl enable mysqld
修改密码
mysql -uroot -pJsq123456...
alter user 'root'@'localhost'IDENTIFIED BY 'Jsq123456...';
flush privileges;
防止出现java.sql.SQLException: null, message from server: "Host 'XXX' is not allowed to connect异常
mysql> use mysql;
mysql> select user,host from user;
mysql> update user set host='%' where user='root';
mysql> select user,host from user;
mysql> flush privileges;
本文来自博客园,作者:jsqup,转载请注明原文链接:https://www.cnblogs.com/jsqup/p/16491595.html