Linux 安裝MySql8.0.*

Linux 安裝MySql8.0.*
安裝mysql源

yum localinstall https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm

安裝mysql

yum install mysql-community-server

安裝mysql的開發包,以後會有用

yum install mysql-community-devel

啓動mysql

systemctl start mysqld.service

查看mysql啓動狀態
在這裏插入圖片描述
出現pid
證明啓動成功
獲取mysql默認生成的密碼

grep 'temporary password' /var/log/mysqld.log

在這裏插入圖片描述

選中的就是密碼。
換成自己的密碼

mysql -uroot -p
Enter password:輸入上頁的密碼,右鍵複製粘貼下來就可以了,進入mysql

更換密碼

ALTER USER 'root'@'localhost' IDENTIFIED BY 'yourPassWord4!';

這個密碼一定要足夠複雜,不然會不讓你改,提示密碼不合法;大小寫加數字加符號
退出mysql並試用下新密碼,命令quit;

mysql> quit;

再連接測試下密碼

mysql -uroot -p

確認密碼正確
到此,mysql安裝成功。

mysql 開啓遠程登錄訪問。
首先,確認你的服務器是否開啓3306端口,若開啓,登錄mysql

[root@~ /]# mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 39
Server version: 5.7.24 MySQL Community Server (GPL)

Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> use mysql;
Database changed
mysql> grant all privileges  on *.* to root@'%' identified by "password";
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> select host,user,password from user;
+--------------+------+-------------------------------------------+
| host         | user | password                                  |
+--------------+------+-------------------------------------------+
| localhost    | root | *A731AEBFB621E354CD41BAF207D884A609E81F5E |
| 192.168.1.1 | root | *A731AEBFB621E354CD41BAF207D884A609E81F5E |
| %            | root | *A731AEBFB621E354CD41BAF207D884A609E81F5E |
+--------------+------+-------------------------------------------+
3 rows in set (0.00 sec)

此時,遠程訪問就開啓成功了

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章