Centos 安裝mysql
安裝mariadb
yum install mariadb mariadb-server mariadb-develmysql
安裝mysql
-
rpm -qa | grep MySql 查看系統是否安裝mysqlsql
-
下載MySQL源安裝包vim
wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm安全
-
安裝MySQL源學習
yum localinstall mysql57-community-release-el7-8.noarch.rpmspa
-
查看MySQL源是否安裝成功.net
yum repolist enabled | grep "mysql.-community."code
-
修改MySQL安裝版本server
vim /etc/yum.repos.d/mysql-community.repoblog
將對應版本的enable=0 改成enable=1;
-
安裝MySQL
yum install mysql-community-server
-
啓動MySQL服務
sudo systemctl start mysqld
-
開機啓動
sudo system enable mysqld
sudo system daemon-reload
-
修改登陸密碼(mysql會初始化一個隨機密碼用於首次登陸(rpm安裝),保存在/var/log/mysql.log中)
cat /var/log/mysqld.log | grep password
-
登陸mysql並修改登陸密碼
- msyql 限制密碼安全性, validate_password_policy值限定了最小密碼長度, 修改使之能夠設置簡單密碼
- set global validate_password_policy=0; 使得密碼判斷長度基於下面的變量
- set global validate_password_length=1;
-
MySQL5.7 中user表中password字段改爲authentication_string了
安裝出現的問題:
Job for mysqld.service failed because the control process exited with error code. See "systemctl status mysqld.service" and "journalctl -xe" for details.
- 刪除/var/lib/mysql 重啓mysql服務 (https://blog.csdn.net/aiyowei1106/article/details/88703746)
學習別人解決問題的思路