1. 查版本
shell> bin/mysqladmin version
2. 查變數設定
shell> bin/mysqladmin variables
3. 停機
shell> bin/mysqladmin -u root shutdown
若root有密碼,則用
shell> mysqladmin -u root -p shutdown
Enter password: (enter root password here)
4. 啟動
shell> bin/mysqld_safe --user=mysql &
5. 檢視資料庫
shell> bin/mysqlshow
shell> bin/mysqlshow mysql
shell> bin/mysql -e "SELECT Host,Db,User FROM db" mysql
6. 檢查預設使用者
mysql> SELECT User, Host, Password FROM mysql.user;
7. 為root設定密碼
方法一、
shell> mysql -u root
mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpwd');
方法二、
shell> mysql -u root
mysql> UPDATE mysql.user SET Password = PASSWORD('newpwd')
-> WHERE User = 'root';
mysql> FLUSH PRIVILEGES;
方法三、
shell> mysqladmin -u root password "newpwd"
8. 刪除匿名使用者
shell> mysql -u root -p
Enter password: (enter root password here)
mysql> DROP USER ''@'localhost';
9. 刪除資料庫
mysql> DROP DATABASE test;
10. 為何localhost 連得上,127.0.0.1卻不可
去防火牆,打開3306port
沒有留言:
張貼留言