一、前言 mysql版本:5.7.11 mysql官方下载地址:https://dev.mysql.com/downloads/mysql/ 需要的安装包 : libaio-0.3.109-13.el7.x86_64.rpm mysql-community-devel-5.7.22-1.el7.x86_64.rpm mysql-connector-python-8.0.11-1.el7.x86_64.rpm mysql-5722.tar.gz mysql-community-libs-5.7.22-1.el7.x86_64.rpm MySQL-python-1.2.5-1.el7.x86_64.rpm mysql-community-client-5.7.22-1.el7.x86_64.rpm mysql-community-libs-compat-5.7.22-1.el7.x86_64.rpm net-tools-2.0-0.22.20131004git.el7.x86_64.rpm mysql-community-common-5.7.22-1.el7.x86_64.rpm mysql-community-server-5.7.22-1.el7.x86_64.rpm
二、安装
lsb_release
getconf LONG_BIT
rpm -qa | grep mysql
rpm -e --nodeps `rpm -qa | grep mysql`
sudo rpm -ivh mysql-community-common-5.7.22-1.el7.x86_64.rpm mysql-community-libs-5.7.22-1.el7.x86_64.rpm mysql-community-server-5.7.22-1.el7.x86_64.rpm mysql-community-client-5.7.22-1.el7.x86_64.rpm mysql-community-devel-5.7.22-1.el7.x86_64.rpm mysql-connector-python-8.0.11-1.el7.x86_64.rpm libaio-0.3.109-13.el7.x86_64.rpm
sudo service mysqld start
grep "temporary password" /var/log/mysqld.log
mysql -u root -p
alter user 'root'@'localhost' identified by 'Td@123456'
grant all privileges on *.* to 'root'@'%' identified by 'Td@123456' with grant option ;
flush privileges;
set global validate_password_policy=0;
set global validate_password_length=5;
三、问题解决
问题一:安装mysql 过程中报错
rpm -ivh mysql-community-common-5.7.22-1.el7.x86_64.rpm mysql-community-libs-5.7.22-1.el7.x86_64.rpm mysql-community-server-5.7.22-1.el7.x86_64.rpm mysql-community-client-5.7.22-1.el7.x86_64.rpm mysql-community-devel-5.7.22-1.el7.x86_64.rpm mysql-connector-python-8.0.11-1.el7.x86_64.rpm MySQL-python-1.2.5-1.el7.x86_64.rpm libaio-0.3.109-13.el7.x86_64.rpm
警告:mysql-community-common-5.7.22-1.el7.x86_64.rpm: 头V3 DSA/SHA1 Signature, 密钥 ID 5072e1f5: NOKEY
错误:依赖检测失败:
mariadb-libs 被 mysql-community-libs-5.7.22-1.el7.x86_64 取代
mariadb-devel 被 mysql-community-devel-5.7.22-1.el7.x86_64 取代
问题二:密码丢失
sudo vi /etc/my.cnf
service mysqld restart
mysql -u root -p
update mysql.user set authentication_string=password('Td@123456') where user='root' ;
sudo vi /etc/my.cnf
service mysqld restart
|