在https://downloads.mariadb.org/mariadb/repositories/#mirror=neusoft该地址中,能够查找对应系统的安装命令配置。
mysql
默认上MariaDB的包并无在Ubuntu仓库中。要安装MariaDB,咱们要设置MariaDB仓库。sql
sudo apt-get install software-properties-common sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8 sudo add-apt-repository 'deb [arch=amd64,i386,ppc64el] http://mirrors.neusoft.edu.cn/mariadb/repo/10.3/ubuntu xenial main'
sudo apt update sudo apt install mariadb-server
在安装中,你会被要求设置MariaDB的root密码。
数据库
mysql -u root -p
sudo /etc/init.d/mysql stop sudo /etc/init.d/mysql start
netstat -an | grep 3306
从上面结果能够看出3306端口只在IP
127.0.0.1
上监听,因此拒绝了其余IP的访问。ubuntu
解决方案:
修改/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,建议注释掉。
从新启动后,从新使用netstat
检测。
less
使用命令测试ide
mysql -h 192.168.0.xxx -u root -p Enter password: ERROR 1130 (HY000): Host '192.168.0.xxx' is not allowed to connect to this MariaDB server
解决方案:须要将用户权限分配给各个远程用户
登陆mysql服务器,使用grant命令分配权限工具
grant all on *.* to '用户名'@'%' identified by '密码'; 例子:grant all on *.* 'root'@'%' identified by '123456';
这样便可远程访问了。测试
建议使用官网自带的便可。
https://downloads.mariadb.org/网站