Centos 7 安装Mysql 5.7

查看是否本机安装了mysql
rpm -qa | grep -i mysql

1.添加MySQL Yum存储库
rpm -ivh https://repo.mysql.com/mysql57-community-release-el7.rpm

2.安装mysql
sudo yum install mysql-community-server

3.启动MySQL服务器
sudo systemctl start mysqld.service

4.您可以使用以下命令检查MySQL服务器的状态:
sudo systemctl status mysqld.service

5.超级用户帐户'root'@'localhost'被建造。设置超级用户的密码并将其存储在错误日志文件中。要显示它,请使用以下命令:
sudo grep 'temporary password' /var/log/mysqld.log

6.通过使用生成的临时密码登录并尽快为超级用户帐户设置自定义密码,以更改root密码:
mysql -uroot -p
ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!';

支持root用户允许远程连接mysql数据库

grant all privileges on *.* to 'root'@'%' identified by '123456' with grant option;
flush privileges;

或者 
update user set host = '%' where user ='root';
flush privileges;

mysql的设置参数中max_allowed_packet过小方法

配置文件修改
vim /etc/my.cnf
[mysqld]
max_allowed_packet = 100M

临时解决方案
set global max_allowed_packet = 10 * 1024 * 1024;
最大值是 1073741824

相关链接:
MySQL :: A Quick Guide to Using the MySQL Yum Repository

上一篇:Bidirectional LSTM-CRF Models for Sequence Tagging【论文笔记】


下一篇:MySQL修改字符集