Living a Simple Life is a Happy Life

有饭吃,自由自在,就非常开心

Mysql Cheat

| Comments

整理一下经常忘记的mysql命令

连接

1
$ mysql -u root -p

list

1
2
$ show DATABASES;
$ show TABLES;

Error

  • ERROR 1045 (28000): Access denied for user ‘root’@’localhost’ (using password: YES)
1
2
3
4
$ mysqld --skip-grant-tables
$ mysql -u root mysql
$ mysql> UPDATE user SET Password=PASSWORD('my_password') where USER='root';
$ mysql> FLUSH PRIVILEGES;

Comments