环境:
- digitalocean CentOS 7.4 x64
- mariadb:10.1.32
首先新建一个文件:sudo vi /etc/yum.repos.d/MariaDB.repo
,编辑内容如下:
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.1/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
然后执行安装命令:
sudo yum install -y MariaDB-server MariaDB-client
检查是否开机自启:
sudo systemctl is-enabled mariadb.service
检查启动状态:
sudo systemctl status mariadb.service
启动服务:
sudo systemctl start mariadb #立刻启动
sudo systemctl enable mariadb #开机启动
sudo systemctl status mariadb #查看服务状态
设置root密码:
sudo /usr/bin/mysqladmin -u root password '1234567890'
通过修改mysql.user表的方式重新修改一下root密码,并配置实现远程连接:
$ /usr/bin/mysql -u root -p
Enter password: 输入你刚刚设置的密码
MariaDB [(none)]> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
MariaDB [mysql]> UPDATE user SET password=PASSWORD('你的密码') WHERE User='root';
#为root数据库用户添加本地访问所有数据库的权限
MariaDB [mysql]> grant all privileges on *.* to root@'localhost' identified by "1234567890";
Query OK, 0 rows affected (0.00 sec)
#为root数据库用户添加远程连接访问所有数据库的权限
MariaDB [mysql]> grant all privileges on *.* to root@'%' identified by "1234567890";
Query OK, 0 rows affected (0.00 sec)
#最后刷新权限
MariaDB [mysql]> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
至此,mariadb安装完毕。
参考:
最新评论
网飞没问题, 迪士尼+有解决方案么?
pp助手是安卓手机用的,根本下载用不来苹果
已解决
这样的话数据库里的结构为{"attachment":{"content":"xxx"}}, 要怎么才能变成{"content":"xxx"},从而使结构保持一致?
赞! make test不过的坑都写到的,谢谢楼主~
谢谢你
用了root用户还是一直502是怎么回事呢
student id 是空的