乐趣区

关于mysql:Centos7安装mysq5729

下载 MySQL 安装包和装置源:

wget https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
yum -y localinstall mysql57-community-release-el7-11.noarch.rpm 

在线装置 MySQL 后启动服务且设置开机启动

yum -y install mysql-community-server
systemctl start mysqld
systemctl enable mysqld
systemctl daemon-reload

批改 root 登录明码

vim /var/log/mysqld.log


登录数据库批改明码

mysql -u root -p
#输出明码
#设置 root 明码
ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';
# 设置近程登录
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;
flush privileges;
exit;
# 开启 3306 端口
firewall-cmd --zone=public --add-port=3306/tcp --permanent;firewall-cmd --reload;firewall-cmd --list-all;
#重启数据库
systemctl restart mysqld;
退出移动版