(1)服务器配置:
[root@localhost ~]# cd /usr/local/src/ [root@localhost src]# wget http://repo.mysql.com/mysql57-community-release-el7-8.noarch.rpm [root@localhost src]# rpm -ivh mysql57-community-release-el7-8.noarch.rpm """ mysql-community-client-5.7.30-1.el7.x86_64.rpm mysql-community-server-5.7.31-1.el7.x86_64.rpm """ 将这两个个rpm包,以FTP形式导入:/var/cache/yum/x86_64/7/mysql57-community/packages/ [root@localhost src]# yum -y install mysql-server
等待时间较长
(2)重置密码与创建用户
#重启mysql服务 [root@VM-0-3-centos src]# service mysqld restart #重置密码 [root@localhost ~]# grep "password" /var/log/mysqld.log
#密码重置mysql> alter user 'root'@'localhost' identified by 'password';//密码重置,新的密码 Query OK, 0 rows affected (0.00 sec) #创建新的用户, mysql> create user 'username'@'%' identified by 'paswword';//添加新的用户,密码 Query OK, 0 rows affected (0.00 sec)#给新用户分权限mysql> grant all privileges on *.* to 'user1'@'%' with grant option; Query OK, 0 rows affected (0.00 sec) #刷新权限 mysql> flush privileges; Query OK, 0 rows affected (0.00 sec)
Query OK, 0 rows affected (0.00 sec)
#刷新权限
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
(3)查询MySql当前用户:
mysql> select user,host from mysql.user; +---------------+-----------+ | user | host | +---------------+-----------+ | user1 | % | | mysql.session | localhost | | mysql.sys | localhost | | root | localhost | +---------------+-----------+ 4 rows in set (0.00 sec) mysql>
(4)实现在Navicat上连接
【常规】端配置参数
【SSH】端配置参数
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。