1、下载MySQL 安装包:
wget https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
yum -y localinstall mysql57-community-release-el7-11.noarch.rpm
2、在线安装MySQL
yum -y install mysql-community-server
3、启动mysql 服务
systemctl start mysqld
4、设置开机启动
systemctl enable mysqld
systemctl daemon-reload
5、修改root登录密码
vim /var/log/mysqld.log
2020-07-21T06:45:28.566414Z 1 [Note] A temporary password is generated for root@localhost: TxUa>Lh>D7B!
mysql -u root -p
ALTER USER 'root'@'localhost' IDENTIFIED BY '新密码'
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '新密码' WITH GRANT OPTION;
6、退出
exit
7、配置mysql默认编码为utf-8
vim /etc/my.cnf
添加如下代码character_set_server=utf8
init_connect='SET NAMES utf8'
systemctl restart mysqld
重启mysqlshow variables like '%character%';
查看编码格式!