centos 安裝MySQL5.7

1、配置yum源mysql

   一、下載yum源 wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpmsql

    二、安裝 yum localinstall mysql57-community-release-el7-8.noarch.rpmthis

    三、檢查是否安裝成功 yum repolist enabled | grep "mysql.*-community.*" server

 2、安裝MySQLget

    一、安裝 yum install mysql-community-serverit

    二、啓動MySQL服務 systemctl start mysqld登錄

    三、查看是否啓動成功 systemctl status mysqld配置

3、MySQL相關設置date

    一、默認密碼再也不是空,安裝時會隨機在/var/log/mysqld.log文件生成一個密碼,查看臨時密碼:下載

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

    二、登陸後修改密碼:set password for 'root'@'localhost'=password('MyNewPass4!');(注意:密碼必須包含大小寫字母、數字和特殊符號,而且長度不能少於8位)

    3 、設置遠程鏈接(不是會報Host ‘XXX’ is not allowed to connect to this MySQL server錯誤)

    mysql>use mysql;

    mysql>update user set host ='%'where user ='root' and host ='localhost';

   mysql>GRANT ALL PRIVILEGES ON *.* TO '(用戶名)'@'%' IDENTIFIED BY '(密碼)' WITH GRANT OPTION;

    mysql>flush privileges;

相關文章
相關標籤/搜索