安装
删除rpm安装的旧版本mysl#
rpm -qa|grep -i mysql
rpm -ev mysql-version-{xx.xx.x}
路径#
通过rpm安装的路径如下:
yum安装mysql5.7#
**1.**
sudo rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022
sudo yum localinstall https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
**2.**
sudo yum install mysql-community-server
sudo systemctl start mysqld
**3.**
# 在第一次启动时,MySQL 将 root 帐户密码存储在日志文件中,可以通过以下命令找到。
grep 'A temporary password' /var/log/mysqld.log |tail -1
**4.**
/usr/bin/mysql_secure_installation
**5.**
mysql -u root -p
修改初始密码#
/usr/bin/mysqladmin -u root password 'new-password'
删除测试数据和匿名用户#
/usr/bin/mysql_secure_installation
添加新用户#
mysql -u root -p123456 -hlocalhost
-----------------
mysql>
GRANT ALL PRIVILEGES ON *.* TO somebody@localhost IDENTIFIED BY 'something' WITH GRANT OPTION;
-----------------
参考#
install mysql5.7 on centos7
How to Install MySQL on CentOS 7: A Step-by-Step Guide