Mysql数据库相关命令与操作
1. Mysql配置文件:
sudo nano /etc/phpmyadmin/config-db.php
2. 重启Mysql服务:
sudo systemctl enable mysql 或 sudo service mysql restart
3. 跳过密码检查登录Mysql:
sudo mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
4. 查到mysql进程:
ps -A |grep mysql
或者
ps ax | grep mysql
5. 以命令行进入Mysql:
sudo mysql
Mysql命令提示符下的相关命令:
使用某个数据库:
use mysql
更新用户密码:
update user set host = '%' where user = 'root';
更改用户密码:
ALTER USER 'root'@'%' IDENTIFIED BY '123456';
选择Mysql用户表:
select host, user from user;
显示用户表结构:
show columns from user;
更新用户表中的某个用户权限:
update mysql.user set authentication_string=password('000') where user='debian' ;
刷新用户权限:
flush privileges;
创建用户:
create user 'phpmyadmin'@'%' identified by '000';
显示某个用户权限:
show grants for 'root'@'localhost';
如果出现“GRANT PROXY ON ``@`` TO `root`@`localhost` WITH GRANT OPTION”这样的结果,使用命令下面命令清理一下:
truncate table mysql.proxies_priv;
把所有用户权限授予给root:
grant all ON *.* to 'root'@'localhost' with grant option; 或者
grant all privileges on *.* to 'root'@'%' with grant option;
6. 出现“Fix MySQL ERROR 1524 (HY000): Plugin 'auth_socket' Is Not Loaded“这样的错误,可以这样试试:
use mysql;
update user set plugin="mysql_native_password";
参考
https://www.cnblogs.com/TEAM0N/p/14238901.html