輸入命令
systemctl start mysql.service
要啟動MySQL數據庫是卻是這樣的提示
Failed to start mysqld.service: Unit not found
解決方法如下:
首先需要安裝mariadb-server
yum install -y mariadb-server
啟動服務
systemctl start mariadb.service
添加到開機啟動
systemctl enable mariadb.service
進行一些安全設置,以及修改數據庫管理員密碼
[zhaojq@localhost]$ mysql_secure_installation
mysql給root開啟遠程訪問權限
use mysql;
select User,authentication_string,Host from user;
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456';
flush privileges;