一、基于rpm方式安裝
1.1 在mysql官網(wǎng)上下載對(duì)應(yīng)的rpm包:
https://dev.mysql.com/downloads/repo/yum/
1.3 安裝rpm:yum -y install mysql80-community-release-el7-3.noarch.rpm
1.4 安裝mysql:yum install -y install mysql-community-server
1.5 啟動(dòng)mysql:
[root@localhost soft]# systemctl start mysqld.service
[root@localhost soft]# systemctl status mysqld.service
● mysqld.service - MySQL Server
? Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
? Active: active (running) since 一 2019-08-26 18:43:48 CST; 28s ago
? ? Docs: man:mysqld(8)
? ? ? ? ? http://dev.mysql.com/doc/refman/en/using-systemd.html
? Process: 15909 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
Main PID: 15997 (mysqld)
? Status: "Server is operational"
? CGroup: /system.slice/mysqld.service
? ? ? ? ? └─15997 /usr/sbin/mysqld
8月 26 18:43:28 localhost.localdomain systemd[1]: Starting MySQL Server...
8月 26 18:43:48 localhost.localdomain systemd[1]: Started MySQL Server.
————————————————
1.6 查看mysql默認(rèn)安裝密碼:
[root@localhost soft]# grep "password" /var/log/mysqld.log
1.8 修改root密碼:
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'test(123456)TEST';
Query OK, 0 rows affected (0.03 sec)
二嗡载、基于mysql安裝包安裝
2.1 下載mysql安裝包
下載地址:https://dev.mysql.com/downloads/mysql/
網(wǎng)盤下載地址:https://pan.baidu.com/s/1bGBriTUB5Iafq1_9uhclYA
2.2 將mysql-8.0.17-linux-glibc2.12-x86_64.tar.xz上傳到linux目錄“/usr/local”下
2.3 解壓這個(gè)安裝包
tar -Jxf mysql-8.0.17-linux-glibc2.12-x86_64.tar.xz
[root@localhost local]# tar -Jxf mysql-8.0.17-linux-glibc2.12-x86_64.tar.xz
[root@localhost local]#
解壓后在“/usr/local”下面將會(huì)多一個(gè)目錄“mysql-8.0.17-linux-glibc2.12-x86_64”
將這個(gè)目錄重命名為mysql:mv mysql-8.0.17-linux-glibc2.12-x86_64 mysql
[root@localhost local]# mv mysql-8.0.17-linux-glibc2.12-x86_64 mysql
2.4 創(chuàng)建mysql用戶組及用戶姿锭,并給mysql用戶設(shè)置密碼
[root@localhost local]# groupadd mysql
[root@localhost local]# useradd -r -g mysql mysql
[root@localhost mysql]# passwd mysql
更改用戶 mysql 的密碼 具滴。
新的 密碼:123qweGHJ
重新輸入新的 密碼:123qweGHJ
passwd:所有的身份驗(yàn)證令牌已經(jīng)成功更新。