mysql的常见问题

1.忘记mysql密码
vi /etc/mysql/my.cnf: 在[mysqld]中添加skip-grant-tables
mysql> use mysql;
Database changed
mysql> select * from  user;
Empty set (0.00 sec)
mysql> truncate table user;
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)
mysql> grant all privileges on *.* to root@localhost identified by 'YourNewPassword' with grant option;
Query OK, 0 rows affected (0.01 sec)
[root ~]# mysql -u root -pYourNewPassword 
2.远程访问
ERROR 2003 (HY000): Can't connect to MySQL server on '192.168.0.202' (111 "Connection refused")
修改sudo vi mariadb.conf.d/50-server.cnf 注释掉bind_address 127.0.0.1

Comments

Popular posts from this blog

sketch 快捷键

ZFS 基础教程