(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)重置密碼與創(chuàng)建用戶
#重啟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)
#創(chuàng)建新的用戶,
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上連接
【常規(guī)】端配置參數
【SSH】端配置參數
以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持腳本之家。