centos7 安装mysql 5.7
1. 移除mariadb
rpm -qa | grep -i mariadb
rpm -e --nodeps 上一条命令查出来的mariadb
2. 下载安装包
https://downloads.mysql.com/archives/community/
3. 打开安装包
tar -xvf mysql-5.7.38-1.el7.x86_64.rpm-bundle.tar
4. 安装
rpm -i mysql-community-common-5.7.38-1.el7.x86_64.rpm
rpm -i mysql-community-libs-5.7.38-1.el7.x86_64.rpm
rpm -i mysql-community-client-5.7.38-1.el7.x86_64.rpm
rpm -i mysql-community-server-5.7.38-1.el7.x86_64.rpm
在/etc/my.conf 下添加
character-set-server=utf8mb4
default_storage_engine=InnoDB
default-time-zone='+08:00'
lower_case_table_names=1
启动
systemctl enable mysqld
systemctl start mysqld
密码处理
cat /var/log/mysqld.log | grep password
2022-08-11T02:47:51.197830Z 1 [Note] A temporary password is generated for root@localhost: ip&z*lK+3yV,
mysql -uroot -p'ip&z*lK+3yV,'
set password for root@localhost = password('这里填你的密码');
CREATE USER 'root'@'%' IDENTIFIED BY 'xxxx';
GRANT ALL ON *.* TO 'root'@'%' IDENTIFIED BY 'xxx';
flush privileges;
posted on 2022-08-11 11:05 cococooder 阅读(127) 评论(0) 编辑 收藏 举报