1、安装MariaDB

oliver@oliver-PC:~$ sudo pacman -S mariadb libmariadbclient mariadb-clients

oliver@oliver-PC:~$ sudo mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql

2. 启动mariadb

oliver@oliver-PC:~$ sudo systemctl start mariadb

oliver@oliver-PC:~$ sudo systemctl stop mysqld

oliver@oliver-PC:~$ sudo mysql_secure_installation

oliver@oliver-PC:~$ sudo systemctl restart mariadb

3root登录:  

mysql -u root -p

  输入刚刚设置的密码即可登陆

4、实现普通用户登陆和管理数据库

划重点三:这个时候如果你使用phpMyadmin或者MYSQL workbench 登录会出如下问题:mysqli_real_connect(): (HY000/1698): Access denied for user ‘root’@’localhost’

普通用户无法使用Mariadbroot用户连接数据库,还是安全保护的的问题,处理方法:

oliver@oliver-PC:~$ sudo mysql -u root -p

Enter password:

Welcome to the MariaDB monitor.  Commands end with ; or \g.

Your MariaDB connection id is 16

Server version: 10.1.37-MariaDB-0+deb9u1 Debian 9.6

 

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

 

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

 

MariaDB [(none)]>CREATE USER '你自己定义的用户名'@'%' IDENTIFIED BY '输入你自己定义的密码';

 

回车,会出现一个更新零行的提示。

MariaDB [(none)]> GRANT ALL PRIVILEGES ON *.* TO '你自己定义的用户名'@'%' WITH GRANT OPTION;

回车,给于该用户所有权限。

然后就可以使用phpMyAdmin或者其他的数据管理工具,通过你定义的用户登录管理数据库了。

 


0 条 查看最新 评论

没有评论
暂时无法发表评论