虚拟机安装mysql

1. 安装mysql数据库

GRANT ALL PRIVILEGES ON . TO ‘root’@’%’ IDENTIFIED BY ‘Kevin031209.’ WITH GRANT OPTION;
centos7 mysql root lXtU+ua#y8Ba(Kevin031209.)
*
下载mysql源:wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
*
安装mysql源:yum localinstall mysql57-community-release-el7-8.noarch.rpm
*
检查mysql源是否安装成功:yum repolist enabled | grep “mysql.-community.
*
安装MySQL:yum install mysql-community-server
*
启动MySQL服务:systemctl start mysqld
*
开机启动: 1. systemctl enable mysqld;2. systemctl daemon-reload

出现alter user授权时。

执行这段代码:alter user ‘root’@‘localhost’ identified by ‘Kevin031209.’;
flush privileges;
*
无法连接虚拟机linux数据库。

进入mysql库。use mysql;
更新host: update user set host=’%’ where host = ‘localhost’;
刷新权限: flush privileges;
查询host,user:select host,user from user;
出现下图说明成功。

你可能感兴趣的:(MySQL)