1.安裝服務
apt-get install mariadb-server
2.啟用啟動服務
sudo systemctl start mariadb sudo systemctl enable mariad
3.后續設置命令
mysql_secure_installation
4.登入數據庫后,設置所有用戶使用root連接,並更新設置。
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '000000' WITH GRANT OPTION; Query OK, 0 rows affected, 1 warning (0.00 sec) mysql> flush privileges;
5.使用navicate遠程連接時出現"10061error“
解決方法:
(1) 修改/etc/mysql/my.cnf文件。打開文件,找到下面內容:
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address = 127.0.0.1
# 把上面這一行注釋掉或者把127.0.0.1換成合適的IP,建議注釋掉。
(2)但現在最新版的mariaDB 已將配置文件拆分此時my.cnf文件里面顯示如下
!includedir /etc/mysqql/conf.d/
!includedir /etc/mysql/mariadb.conf.d/
# 這兩句話的意思是配置文件包含了上面兩個文件夾所有的文件,那么現在一一查找bind-address = 127.0.0.1這句話寫在哪了。
之后在/etc/mysql/mariadb.conf.d/50-server.cnf此文件下找到bind-address = 127.0.0.1這句話,注釋掉就行了。