Mysql---Centos7軟件安裝

Mysql---Centos7軟件安裝

rpm安裝

1. 下載rpm

http://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpmphp

2. 安裝rpm

rpm -uvh(-ivh) mysql57-community-release-el7-9.noarch.rpmmysql

3. 安裝mysql

sudo yum install mysql-community-serversql

4. 啓動mysql

sudo service mysqld startshell

5. 查看mysql狀態

sudo service mysqld status函數

6. 查看安裝過程當中生成的默認密碼

sudo grep 'temporary password' /var/log/mysqld.log日誌

7. 登陸mysql

mysql -u root -p code

8. 修改mysql默認密碼校驗規則

若是發現語句沒法執行,應該是語句中的空格問題,手打代替粘貼複製。orm

#密碼強度可由validate password strength()函數評估(返回0至100之間的數),如:
mysql>select VALIDATE_PASSWORD_STRENGTH('123456');
mysql>select VALIDATE_PASSWORD_STRENGTH('Password@123456');
#修改方法以下:
set global validate_password_policy=low;
set global validate_password_length=4;
ALTER USER USER() IDENTIFIED BY '123456';
mysql> SHOW VARIABLES LIKE 'validate_password%';
+--------------------------------------+-------+
| Variable_name                        | Value |
+--------------------------------------+-------+
| validate_password_check_user_name    | OFF   |
| validate_password_dictionary_file    |       |
| validate_password_length             | 8     |
| validate_password_mixed_case_count   | 1     |
| validate_password_number_count       | 1     |
| validate_password_policy             | LOW   |
| validate_password_special_char_count | 1     |
+--------------------------------------+-------+
7 rows in set (0.00 sec)
mysql>

Mysql日誌:

mysql>  select @@log_error;
+---------------------+
| @@log_error         |
+---------------------+
| /var/log/mysqld.log |
+---------------------+
1 row in set (0.00 sec)
mysql> 
# grep "password" /var/log/mysqld.log 命令獲取MySQL的臨時密碼

Mysql安裝

一、sudo rpm -Uvh platform-and-version-specific-package-name.rpm
二、sudo rpm -Uvh mysql57-community-release-el6-n.noarch.rpm
三、yum repolist all | grep mysql
四、sudo yum install mysql-community-server
五、sudo service mysqld start
六、sudo service mysqld status
七、sudo grep 'temporary password' /var/log/mysqld.log
八、mysql -uroot -p 
九、ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!';

其餘資源

MySQL入門server

相關文章
相關標籤/搜索