MySQL5.7安装
.yum安装,先要搞到源
wget http://repo.mysql.com/mysql57-community-release-el7-9.noarch.rpm
sudo rpm -ivh mysql57-community-release-el7-9.noarch.rpm
2.更新yum软件包
yum check-update
3.更新系统
yum update
4.安装mysql
yum install mysql mysql-server
*********************接下来是漫长的等待。如果中途关机,或者下载挂了,请执行卸载步骤后,再来一次。完成后记住要给root上密码***********
systemctl start mysqld
mysql -u root
mysql> update mysql.user set authentication_string=password('admin') where user='root' and Host ='localhost';
mysql> flush privileges;
mysql> quit;
5.启动与开放远程访问
systemctl start mysqld
mysql -u root -p
6.授权远程访问
use mysql;
grant all privileges on *.* to root@'%' identified by "admin";
grant all privileges on *.* to piwik@'%' identified by "ph20190420";
FLUSH PRIVILEGES;
create user user@'%' identified by 'admin'
7.查看初始密码
grep 'temporary password' /var/log/mysqld.log
1.root登陆mysql
8.密码强度低时报错问题解决
mysql> set global validate_password_policy=0;
mysql> set global validate_password_mixed_case_count=0;
mysql> set global validate_password_number_count=3;
mysql> set global validate_password_special_char_count=0;
mysql> set global validate_password_length=3;
alter user root@localhost identified by 'admin';
9.数据库启动,停止,重启
systemctl start mysqld
systemctl stop mysqld
service mysqld restart
10.修改max_allowed_packet
用VI打开/etc/my.cnf,增加下面一行,这句话是把上传文件大小改到64M:
max_allowed_packet = 64M piwik建议
查看当前大小
show variables like '%max_allowed_packet%';