文章目录
- 一、下载安装
- 1.下载
- 2.安装
- 二、常见问题
- 1.You must reset your password using ALTER USER statement before executing this statement
- 2.IP is not allowed to connect to this mysql
- 结尾
提示:以下是本篇文章正文内容,下面案例可供参考
一、下载安装
1.下载
进入MySQL官网 >> downloads >> MySQL Community(GPL)Downloads
点击MySQL Community Server
根据自己的服务器架构和Linux版本选择软件
2.安装
按顺序进行安装
rpm -ivh mysql-community-common-8.0.37-1.el8.x86_64.rpm
rpm -ivh mysql-community-client-plugins-8.0.37-1.el8.x86_64.rpm
rpm -ivh mysql-community-libs-8.0.37-1.el8.x86_64.rpm
rpm -ivh mysql-community-client-8.0.37-1.el8.x86_64.rpm
rpm -ivh mysql-community-icu-data-files-8.0.37-1.el8.x86_64.rpm
rpm -ivh mysql-community-server-8.0.37-1.el8.x86_64.rpm
初始化SQL
#初始化MYSQL
mysqld --initialize --console
#查看初始密码
grep 'temporary password' /var/log/mysqld.log
登录MYSQL
#启动服务
systemctl start mysqld
#首次登录
mysql -uroot -p
mysql(linux)开启远程登录
use mysql;
update user set host="%" where user="root";
flush privileges;
二、常见问题
1.You must reset your password using ALTER USER statement before executing this statement
mysql> mysql -uroot -p
mysql> alter user 'root'@'localhost' identified by '123';
2.IP is not allowed to connect to this mysql
mysql> update user set host ='%' where user = 'root';
mysql> flush privileges;
结尾
- 感谢大家的耐心阅读,如有建议请私信或评论留言。
- 如有收获,劳烦支持,关注、点赞、评论、收藏均可,博主会经常更新,与大家共同进步