1. 程式人生 > >mysql8.0 centOs安裝教程

mysql8.0 centOs安裝教程

 

rpm安裝:

$ rpm -ivh mysql-community-common-5.7.19-1.el6.x86_64.rpm

 

$ rpm -ivh mysql-community-libs-5.7.19-1.el6.x86_64.rpm

 

$ rpm -ivh mysql-community-clients-5.7.19-1.el6.x86_64.rpm

 

$ rpm -ivh mysql-community-server-5.7.19-1.el6.x86_64.rpm

 

!!!這裡出現的錯誤

1

2

3

4

5

6

7

8

# error: Failed dependencies: \

        libnuma.so.1()(64bit) is needed by mysql-community-server-5.7.19-1.el6.x86_64 \

        libnuma.so.1(libnuma_1.1)(64bit) is needed by mysql-community-server-5.7.19-1.el6.x86_64 \

        libnuma.so.1(libnuma_1.2)(64bit) is needed by mysql-community-server-5.7.19-1.el6.x86_64

 

解決方法:

 

$ yum install -y numactl

 

4. 安裝好後,可以去檢查是否存在MySQL的配置檔案或者MySQL的命令在/usr/bin下

1

2

3

4

5

6

#mysql配置檔案

ls /etc/my.cnf

 

# mysql命令

cd /usr/bin/

ls grep mysql

 啟動MySQL之前:在etc/my.cnf 中新增:

    lower_case_table_names=1

注:mysql8.0如果啟動後新增,會啟動報錯。

1

2

/etc/init.d/mysqld start

ps aux|grep mysqld

 

根據var/log/mysql.log檔案檢視預設初始密碼。

[Server] A temporary password is generated for [email protected]: brdLtSfh!90b

修改密碼:

mysqadmin -u test -p password A123456789a!

回車後:輸入系統預設密碼

注:這裡密碼設定的複雜一些,mysql8.0預設不能設定簡單密碼。

執行:mysql -uroot -p

進入mysql後:

設定遠端連線許可權:update user set host='%' where user ='root';

執行重新整理許可權:flush privileges;

執行:select host,user from mysql.user;    查看錶格中是否修改。

MYSQL 8.0內新增加mysql_native_password函式,通過更改這個函式密碼來進行遠端連線。

mysql> ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY'[email protected]';

Query OK, 0 rows affected (0.15 sec)

接下來,用navicate連線就可以了。