您好,登錄后才能下訂單哦!
1.新建組、新建用戶
[root@ticent admin]# groupadd mysql
[root@ticent admin]# useradd -m -g mysql mysql
[root@ticent admin]#
2.查看是否已經安裝,如已經安裝,需要先移除
[root@ticent admin]# rpm -qa | grep mysql
[root@ticent admin]#
3.修改mysql用戶密碼
[root@ticent admin]# passwd mysql
4.下載
[mysql@ticent ~]$ wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-community-client-5.7.18-1.el7.x86_64.rpm
[mysql@ticent ~]$ wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-community-libs-5.7.18-1.el7.x86_64.rpm
[mysql@ticent ~]$ wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-community-common-5.7.18-1.el7.x86_64.rpm
[mysql@ticent ~]$ wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-community-server-5.7.18-1.el7.x86_64.rpm
[mysql@ticent ~]$ ll
總用量 157960
-rw-rw-r--. 1 mysql mysql 25079412 3月 20 17:40 mysql-community-client-5.7.18-1.el7.x86_64.rpm
-rw-rw-r--. 1 mysql mysql 277784 3月 20 17:40 mysql-community-common-5.7.18-1.el7.x86_64.rpm
-rw-rw-r--. 1 mysql mysql 2237888 3月 20 17:40 mysql-community-libs-5.7.18-1.el7.x86_64.rpm
-rw-rw-r--. 1 mysql mysql 128210634 6月 6 01:02 mysql-community-server-5.7.18-1.el7.x86_64.rpm
5.可以使用root用戶安裝,也可以使用mysql用戶安裝。若使用mysql,則需要先修改/etc/sudoers文件,如下,添加標記的內容。使用root則不需要設置。
[root@ticent admin]# vi /etc/sudoers
6.移除mariadb-libs
[mysql@ticent ~]$ sudo rpm -e mariadb-libs-5.5.52-1.el7.x86_64 --nodeps
7.安裝perl
[root@ticent mysql]# yum install perl
8.安裝mysql
[mysql@ticent ~]$ sudo rpm -ivh mysql-community-common-5.7.18-1.el7.x86_64.rpm
警告:mysql-community-common-5.7.18-1.el7.x86_64.rpm: 頭V3 DSA/SHA1 Signature, 密鑰 ID 5072e1f5: NOKEY
準備中... ################################# [100%]
正在升級/安裝...
1:mysql-community-common-5.7.18-1.e################################# [100%]
[mysql@ticent ~]$ sudo rpm -ivh mysql-community-libs-5.7.18-1.el7.x86_64.rpm
警告:mysql-community-libs-5.7.18-1.el7.x86_64.rpm: 頭V3 DSA/SHA1 Signature, 密鑰 ID 5072e1f5: NOKEY
準備中... ################################# [100%]
正在升級/安裝...
1:mysql-community-libs-5.7.18-1.el7################################# [100%]
[mysql@ticent ~]$ sudo rpm -ivh mysql-community-client-5.7.18-1.el7.x86_64.rpm
警告:mysql-community-client-5.7.18-1.el7.x86_64.rpm: 頭V3 DSA/SHA1 Signature, 密鑰 ID 5072e1f5: NOKEY
準備中... ################################# [100%]
正在升級/安裝...
1:mysql-community-client-5.7.18-1.e################################# [100%]
[mysql@ticent ~]$ sudo rpm -ivh mysql-community-server-5.7.18-1.el7.x86_64.rpm
警告:mysql-community-server-5.7.18-1.el7.x86_64.rpm: 頭V3 DSA/SHA1 Signature, 密鑰 ID 5072e1f5: NOKEY
準備中... ################################# [100%]
正在升級/安裝...
1:mysql-community-server-5.7.18-1.e################################# [100%]
9.初始化
[mysql@ticent ~]$ mysqld --initialize
10.啟動服務
[mysql@ticent ~]$ service mysqld start
11.查看臨時密碼
[mysql@ticent ~]$ cat /var/log/mysqld.log
12.使用初始密碼登錄,修改密碼
[mysql@ticent ~]$ mysql -u root -p
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '123';
mysql> flush privileges;
13.再次登錄驗證成功
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。