mysql yum 安裝

zwhfyy發表於2020-11-08

先解除安裝

 

然後安裝

yum install mysql -y

rpm -Uvh http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm

yum install mysql-server -y

yum install mysql-devel -y



systemctl stop firewalld.service
systemctl stop firewalld
systemctl disable firewalld
sleep 6s





修改配置

vim /etc/my.cnf

內容如下:

[mysqld]
port = 3306

 

常用命令:

service mysqld start      --啟動mysql
service mysqld stop       --關閉mysql·
lsof -i:3306              --資料庫埠是否開啟

 

mysqladmin -u root password 密碼
use mysql;
UPDATE user SET `Host` = '%' WHERE `User` = 'root' LIMIT 1;

然後重啟下mysql

開機自啟動

echo "service mysqld start" >> /etc/rc.local

或者進入/etc/目錄,直接vim rc.local編輯rc.local檔案,在最後一行新增“service mysqld start”,儲存退出

 

 

 

 

 

相關文章