1、在 /etc/yum.repos.d/
下建立 MariaDB.repo,内容参照下面的链接,根据自己的系统选择:
https://downloads.mariadb.org/mariadb/repositories/#mirror=shanghai-university
如下:
Here is your custom MariaDB YUM repository entry for CentOS. Copy and paste it into a file under /etc/yum.repos.d/ (we suggest naming the file MariaDB.repo or something similar).
# MariaDB 10.3 CentOS repository list - created 2019-05-31 02:06 UTC
# http://downloads.mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.3/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
After the file is in place, install MariaDB with:
sudo yum install MariaDB-server MariaDB-client
If you haven't already accepted the MariaDB GPG key, you will be prompted to do so. See "Installing MariaDB with yum" for detailed information.
Please see Installing OQGraph for details on additional install steps needed for that storage engine.
2、执行命令:sudo yum install MariaDB-server MariaDB-client
3、使用systemctl 启停,如下:
systemctl start mariadb
systemctl stop mariadb
systemctl status mariadb
systemctl enable mariadb
4、配置
执行命令:mysql_secure_installation,然后根据提示一步一步配置,其中有一项是设置root的登录密码
5、远程访问授权:
使用mysql -uroot -p密码登录后,执行命令:
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '你的密码的明文' WITH GRANT OPTION;
FLUSH PRIVILEGES;
6、如果远程访问,并且数据量很大,则需要进行如下配置,否则会出现MySQL server has gone away 的
错误 :
set global max_allowed_packet=1024*1024*16;