yum安装8.0mysql数据库

yum安装依赖包

yum -y install libaio

下载mysql_8.x版本rpm包

wget http://repo.mysql.com/mysql80-community-release-el7-1.noarch.rpm

安装mysql_yum源

yum localinstall mysql80-community-release-el7-1.noarch.rpm

查看yum包是否存在

yum repolist enabled |grep "mysql.*-community.*"

mysql-connectors-community/x86_64 MySQL Connectors Community 203

mysql-tools-community/x86_64 MySQL Tools Community 129

mysql80-community/x86_64 MySQL 8.0 Community Server 265

yum安装mysql

yum install mysql-community-server -y

systemctl start mysqld

systemctl status mysql

查看mysql初始密码

grep password /var/log/mysqld.log

登录mysql

mysql -uroot -p
Enter password:
Server version: 8.0.25-----(MySQL版本)
......
Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.

mysql>

修改初始密码

mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '你的密码';

修改权限可以远程登录mysql

mysql> select host,user,authentication_string,plugin from user;
mysql> update user set host='%' where user='root';
mysql> flush privileges;

原文地址:https://www.cnblogs.com/cfy930721/p/14850471.html