Centos7 安裝 mysql 8mysql
執行下面兩條命令:sql
yum localinstall https://dev.mysql.com/get/mysql80-community-release-el7-1.noarch.rpmyum install mysql-community-server
啓動mysql (centos7以上):centos
啓動mysql服務:tcp
sudo
systemctl start mysqld
加密
將mysql服務添加到開機啓動:centos7
sudo systemctl enable mysqld
@server
spa
增強版命令(能夠顯示更多信息):code
(centos 7):server
systemctl status mysqld
(centos6):ip
service mysqld status
啓動mysql(centos6 如下):
service start mysqld
關閉mysql:
systemctlstopmysqld第一次啓動mysql臨時鏈接密碼:sudo grep 'temporary password' /var/log/mysqld.logmysql設置密碼:(要用到臨時密碼)sudo mysql_secure_installation以root用戶權限 登陸mysql:mysql -u root -p
建立一個新的root用戶並啓用遠程登陸:CREATE USER 'root'@'%' IDENTIFIED BY 'new_rootpassword';GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;更改加密方式(在mysql8中不更改navicat鏈接不上mysql8):ALTER USER 'root'@'%' IDENTIFIED BY 'password' PASSWORD EXPIRE NEVER;刷新權限:FLUSH PRIVILEGES;
開啓端口firewall-cmd --permanent –add-port=端口/tcp重啓 firewallfirewall-cmd --reload