创建数据库本地用户zhuohua@localhost,并赋权:
MariaDB [(none)]> grant all on *.* to zhuohua@localhost identified by '888';
查看数据库本地用户zhuohua@localhost的权限:
MariaDB [(none)]> show grants for zhuohua@localhost;
+-------------------------------------------------------------------------------------------------------------------------+
| Grants for zhuohua@localhost |
+-------------------------------------------------------------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'zhuohua'@'localhost' IDENTIFIED BY PASSWORD '*A4B6157319038724E3560894F7F932C8886EBFCF' |
+-------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.000 sec)
查看数据库管理员root@localhost的权限:
MariaDB [(none)]> show grants for root@localhost;
+---------------------------------------------------------------------+
| Grants for root@localhost |
+---------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION |
| GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION |
+---------------------------------------------------------------------+
2 rows in set (0.000 sec)
###############
###############
phpMyAdmin(PHP语言编写的,是远程管理MySQL/MariaDB的工具)
下载phpMyAdmin:https://pan.baidu.com/s/1ca0GQSzxnSjXIUEPNmBX3Q 提取码:bl19
安装phpMyAdmin:
tar -zxvf phpMyAdmin-4.4.15.6-all-languages.tar.gz -C /var/www/html/
cd !$
mv phpMyAdmin-4.4.15.6-all-languages/ phpMyAdmin
cd !$
mv config.sample.inc.php config.inc.php
重启Apache:
[root@centos8 ~]# systemctl restart httpd
phpMyAdmin的配置文件:
[root@centos8 phpMyAdmin]# pwd
/var/www/html/phpMyAdmin
[root@centos8 phpMyAdmin]# vi config.inc.php
注释:只有数据库管理员root才能编辑数据库用户的权限。
###
给数据库管理员root清空密码:
MariaDB [(none)]> use mysql;
MariaDB [mysql]> update user set password=password('') where user='root';
MariaDB [mysql]> flush privileges;
数据库管理员root又可以无密码登录MariaDB了: