nianxue

导航

Linux安装mysql8.0

MySQL

配置MySQL8安装源
sudo rpm -Uvh https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm
安装MySQL8(提示下载包,选y,后面有其他提示都选y)
sudo yum --enablerepo=mysql80-community install mysql-community-server
运行以下命令查看MySQL版本号
mysql -V
启动mysql服务
systemctl start mysqld 
查看mysql启动状态
systemctl status mysqld.service
设置mysql开机启动

设置开机自启

systemctl enable mysqld 

 重启systemctl

systemctl daemon-reload 
查看mysql生成的随机密码
grep "password" /var/log/mysqld.log
更改密码
mysql -uroot -p

先修改密码为复杂密码

alter user 'root'@'localhost' identified by 'A12345678@a';
ALTER USER 'root'@'localhost' IDENTIFIED BY 'A12345678@a' PASSWORD EXPIRE NEVER;
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'A12345678@a';
FLUSH PRIVILEGES;
use mysql;
update user set host = '%' where user ='root';
FLUSH PRIVILEGES;
exit;
 

 

posted on 2022-08-24 10:19  卿屿  阅读(31)  评论(0编辑  收藏  举报