MySQL 連線權限簡介
第一次安裝 MySQL 設定新密碼:
# mysqladmin -u root password NEW_PASSWORD
以後更改密碼,其指令為:
# mysqladmin -u root -p password NEW_PASSWORD
Enter password: (YOUR OLD PASSWORD)
連線 MySQL
# mysql -u root -p 原密碼
# mysql -u root -p (此方式,會在進入後要求密碼)
建立連線帳號、權限:
mysql> grant all privileges on net00db.* to net00@localhost IDENTIFIED BY '12345678' ;
(表示 localhost 以 net00 帳號,密碼為 12345678 連線者,擁有對資料表:net00db 的所有權限,可以增刪、修改等權利)
更改密碼
mysql>set password for net00@localhost = password('1234'); (更改net00@localhost密碼)
mysql> FLUSH PRIVILEGES ; (系統更新,使改變的部份產生作用。)
刪除權限
REVOKE priv_type [(column_list)] [, priv_type [(column_list)] ...]
ON {tbl_name | * | *.* | db_name.*}
FROM user_name [, user_name ...]
密碼遺忘,補救方法 (hami 提供)
root 密碼忘了,可按照下列方式更正:
1.先停掉mysql
# /etc/rc.d/init.d/mysql stop
2.以--skip-grant-table 的參數啟動mysql
# safe_mysql --skip-grant-table&
3. 更改root 密碼
# mysql mysql
mysql> UPDATE user SET password=password('newpassword')
WHERE user='root';
mysql> FLUSH PRIVILEGES;
mysql> exit
4.停掉mysql再重跑
# mysqladmin -uroot -p shutdown
Enter password: //輸入新設定的密碼
# /etc/rc.d/init.d/mysql start
安裝 phpMyAdmin
phpMyAdmin 修改部份 config.inc.php
$cfgServers[1]['host'] = 'localhost'; // MySQL hostname
$cfgServers[1]['port'] = ''; // MySQL port - leave blank for default port
$cfgServers[1]['adv_auth'] = true; // Use advanced authentication?
$cfgServers[1]['stduser'] = 'root'; // MySQL standard user (only needed with advanced auth)
$cfgServers[1]['stdpass'] = '123456'; // MySQL standard password (only needed with advanced auth)
$cfgServers[1]['user'] = 'root'; // MySQL user (only needed with basic auth)
$cfgServers[1]['password'] = '123456'; // MySQL password (only needed with basic auth)
require "chinese_big5.inc.php" ; //中文訊息
- Jul 01 Fri 2011 02:10
MySQL 連線權限簡介
全站熱搜
留言列表