mysql5.7安装(yum在线方式)
安装
wget https://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm rpm -ivh mysql57-community-release-el7-9.noarch.rpm yum install mysql-server systemctl start mysqld
修改密码
找到初始密码 grep 'temporary password' /var/log/mysqld.log 2020-04-11T07:53:15.951160Z 1 [Note] A temporary password is generated for root@localhost: g(wfb5Nhf.2L 登录修改密码 mysql -u root -p ALTER USER 'root'@'localhost' IDENTIFIED BY '1qaz@WSX';
开启远程
mysql -u root -p show databases; use mysql; show tables; update user set Host='%' where User='root'; grant all privileges on *.* to root@"192.168.1.9" identified by "1qaz@WSX"; flush privileges;
配置默认编码为utf8
vi /etc/my.cnf #添加 [mysqld] character_set_server=utf8 init_connect='SET NAMES utf8'
重启/设置开机启动
systemctl restart mysqld
systemctl enable mysqld
参考:
https://blog.csdn.net/wohiusdashi/article/details/89358071