centOs中mysql啟動(dòng)失敗解決辦法——改裝mariadb

再centOs7 中安裝mysql,運(yùn)行

systemctl restart mysql
//后報(bào)錯(cuò)
Failed to start mysqld.service: Unit not found

由于MySQL在CentOS7中收費(fèi)了,所以已經(jīng)不支持MySQL了,取而代之在CentOS7內(nèi)部集成了mariadb,而安裝MySQL的話會(huì)和MariaDB的文件沖突。所以本文建議直接安裝mariadb。

具體討論的詳情大家可以參考知乎討論:https://www.zhihu.com/question/41832866,本文不再贅述。

輸入命令

 systemctl start mysql.service

要啟動(dòng)MySQL數(shù)據(jù)庫(kù)是卻是這樣的提示

Failed to start mysqld.service: Unit not found

解決方法如下:

首先需要安裝mariadb和mariadb-server

yum -y install mariadb  mariadb-devel  mariadb-server

啟動(dòng)服務(wù)

systemctl start mariadb.service

添加到開機(jī)啟動(dòng)

systemctl enable mariadb.service

進(jìn)行一些安全設(shè)置,以及修改數(shù)據(jù)庫(kù)管理員密碼

[zhaojq@localhost]$  mysql_secure_installation
image.png
mysql給root開啟遠(yuǎn)程訪問(wèn)權(quán)限
use mysql;
select  User,authentication_string,Host from user;
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456';
flush privileges;
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容