赞
踩
openEuler-22.09 也适用
yum list installed | grep mysql
有安装信息的话就卸载
yum remove mysql-community-server
rpm -qa|grep mysql
rpm -e 名称
例如:rpm -e pcp-pmda-mysql
强制卸载,添加--nodeps
例如: rpm -e --nodeps akonadi-mysql
rm -rf /var/lib/mysql
rm -rf /etc/my.cnf
rm -rf /user/share/mysql-8.0
MySQL :: Download MySQL Community Server
tar xvf mysql-8.0.32-1.el8.x86_64.rpm-bundle.tar
依赖关系依次为common→libs→client→server
注意:先不要运行!!!根据需求编辑配置文件my.cnf 否则后期更改可能会导致无法启动mysql需要重新安装。
vim /etc/my.cnf
- port = 3306
-
- character-set-server=utf8mb4
-
- default-storage-engine=INNODB
-
- expire-logs-days=14
-
- max-binlog-size=500M
-
- server-id=1
-
- lower_case_table_names=1 # 设置不区分大小写
-
-
-
- [client]
-
- port = 3306
-
- default-character-set=utf8mb4
- systemctl start mysqld
-
- systemctl status mysqld
cat /var/log/mysqld.log | grep 'password is generated'
mysql -uroot -p
首次密码验证策略高,所以先修改默认密码为: Root@123456 满足它的策略
alter user root@'localhost' identified with mysql_native_password by 'Root@123456';
set global validate_password.policy=LOW;
set global validate_password.length=6;
ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';
grant all privileges on *.* to 'root'@'localhost' with grant option;
use mysql
update user set host='%' where user='root' and host='localhost' limit 1;
flush privileges;
firewall-cmd --list-ports
- firewall-cmd --zone=public --add-port=3306/tcp –permanent
-
- firewall-cmd --reload
开机自启
- 启动
-
- systemctl start mysqld
-
- 停止
-
- systemctl stop mysqld
-
- 查看运行状态
-
- systemctl status mysqld
-
- 设置开机启动
-
- systemctl enable mysqld
报错后再语句后边加 --nodeps --force
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。