mysql 常用操作
阿新 • • 發佈:2021-01-05
mysql常用操作
服務相關
[root@vm10-0-0-3 etc]# service mysql stop Shutting down MySQL.... [ OK ] [root@vm10-0-0-3 etc]# service mysql status MySQL is not running [FAILED] [root@vm10-0-0-3 etc]# service mysql start Starting MySQL. [ OK ] [root@vm10-0-0-3 etc]# service mysql restart Shutting down MySQL.... [ OK ] Starting MySQL. [ OK ]
重置密碼
在my.cnf中新增
skip-grant-tables
重啟mysql服務
[root@vm10-0-0-3 etc]# service mysql restart
Shutting down MySQL.... [ OK ]
Starting MySQL. [ OK ]
連線mysql服務
[root@vm10-0-0-3 etc]# mysql mysql> use mysql Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Database changed
修改root使用者密碼
mysql> update user set authentication_string=password('root') where user="root";
Query OK, 1 row affected, 1 warning (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 1
註釋my.cnf中的skip-grant-tables
重啟mysql服務