mysql安裝運行(centos)

http://repo.mysql.com尋找須要的版本mysql

wget -P /opt/downloads http://repo.mysql.com/mysql57-community-release-el7-11.noarch.rpm
rpm -ivh /opt/downloads/mysql57-community-release-el7-11.noarch.rpmsql

查看要安裝的vim

yum repolist enabled | grep mysql.*bash


yum install mysql-community-servertcp

已安裝rest

yum list installed | grep mysql日誌

 

mysqld位置:/usr/sbin/mysqld
運行文件位置:/usr/bin/mysql
數據文件存放路徑:/var/lib/mysql
安裝路徑/var/lib/mysql
配置文件:/etc/my.cnf
日誌文件:/var/log/var/log/mysqld.log
服務啓動腳本:/usr/lib/systemd/system/mysqld.service
進程標識文件:/var/run/mysqld/mysqld.pidcode


修改配置
vim /etc/my.cnfserver

加入
validate_password = OFF進程


service mysqld restart
service mysqld status
cat /var/log/mysqld.log | grep "temporary password" 查看密碼並複製
mysql -u root -p
輸入系統密碼

 

把臨時隨機密碼改爲正式密碼

SET PASSWORD = PASSWORD('123456');

 

 

容許遠程訪問
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;
flush privileges;

查看防火牆狀態
systemctl status firewalld.service
若要遠程訪問需:
關閉防火牆
systemctl stop firewalld.service
或穿透3306端口
iptables -I INPUT -p tcp --dport 3306 -j ACCEPT

 

systemctl enable mysqld.servicesystemctl start mysqld.servicesystemctl status mysqld.service

相關文章
相關標籤/搜索