Linux下安裝MySQL(mariadb)

一、安裝mysql

yum -y install MariaDB-server

二、啓動sql

systemctl start mariadb #啓動服務
systemctl enable mariadb #設置開機啓動
systemctl restart mariadb #從新啓動
systemctl stop mariadb.service #中止MariaDB

三、登陸rest

用mysql -uroot命令登陸到MariaDB,此時root帳戶的密碼爲空。server

四、修改密碼ip

mysql_secure_installation

五、忘記密碼io

5.1.修改MySQL的登陸設置: 
# vi /etc/my.cnf 
在[mysqld]的段中加上一句:skip-grant-tables mariadb

5.3 修改密碼table

mysql_secure_installation

5.4 修改爲功後,移除剛纔添加的那句話,而後重啓mariadb登錄

相關文章
相關標籤/搜索