【转载】https://www.cnblogs.com/Cookies-Tang/p/10871556.html
前言
MariaDB是由原本开发MySQL的一些原始开发者领导,他们担心Oracle收购MySQL后会有一些隐患。MariaDB与MySQL保持这高度兼容性,并使用了一个新的存储引擎Aria。
安装MriaDB
sudo apt-get install mariadb-server
静静的等待安装完成即可,中间会询问是否继续,输入Y继续即可。安装完成后就可以通过一下命令连接到MariaDB
sudo mysql
出现如下讯息表示已成功连接到MariaDB了
Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 6 Server version: 10.1.38-MariaDB-0+deb9u1 Raspbian 9.0 Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type'help;'or'\h'forhelp. Type'\c'to clear the current input statement. MariaDB [(none)]>
配置密码访问
默认情况下MariaDB安装好后都没有配置访问用户的密码,因此如果需要远程连接时会无法连接。因此需要先對root用户设置密码。首先透过上一步中的命令连接至MariaDB,输入如下语句进行密码的修改
usemysql;
UPDATEuserSETpassword=password('password')WHEREuser='root';
UPDATEuserSETplugin='mysql_native_password'WHEREuser='root';
flushprivileges;
exit
以上执行完成后,重启服务
sudo systemctl restart mariadb
重启完成后,试用密码进行mariadb登录,验证是否修改成功
mysql -u root -p
输入上面设置的密码就可以看到第一步安装完成登录时一样的画面了。