目录:
1. Select查询表时阻塞
表可能被锁。
1
2
3
4
5
6
7 | mysql> show OPEN TABLES where In_use > 0;
+--------------+-----------------+--------+-------------+
| Database | Table | In_use | Name_locked |
+--------------+-----------------+--------+-------------+
| demodatabase | demo_table_1234 | 1 | 0 |
+--------------+-----------------+--------+-------------+
1 row in set (0.00 sec)
|
这时候显示表 demo_table_1234 已被使用
2. 查看RDS系统资源
查看RDS系统资源
1
2
3
4
5 | #查看性能指标,累计值
mysqladmin -hlocalhost -uroot extended-status
#查看性能指标,1秒内差值
mysqladmin -hlocalhost -uroot extended-status --relative --sleep=1
|
3. 修改密码的几种方法
方法1: SET PASSWORD命令
1
2 | mysql -u root
mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpass');
|
方法2: mysqladmin
1 | mysqladmin -u root password "newpass"
|
如果root已经设置过密码,采用如下方法
1 | mysqladmin -u root password oldpass "newpass"
|
方法3: UPDATE user
1
2
3
4 | mysql -u root
mysql> use mysql;
mysql> UPDATE user SET Password = PASSWORD('newpass') WHERE user = 'root';
mysql> FLUSH PRIVILEGES;
|
方法4: 丢失root密码时
1
2
3
4 | mysqld_safe --skip-grant-tables&
mysql -u root mysql
mysql> UPDATE user SET password=PASSWORD("new password") WHERE user='root';
mysql> FLUSH PRIVILEGES;
|