資料庫管理員的職責
伺服器的啟動與關閉
用戶帳戶維護
日誌檔案維護
資料庫的備份與拷貝
> 資料目錄的安全性
伺服器的安全性
災難復原
預防性維護
````````````````````````````````````````````` ``````````````````````````
資料庫的啟動與關閉
1、資料庫的啟動:
方法一:使用service 指令啟動MySQL
# service mysqld start
// mysqld是MySQL的守護程式,並透過執行它來啟動MySQL服務。
方法二:使用mysqld腳本啟動MySQL
# /etc/init.d/mysqld start
方法三:使用safe_mysqld sa0, 🎜> 使用&符號將safe_mysqld放在後台運行。
``````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````『 ````````````
校驗MySQL是否啟動:
# service mysqld status
//回傳下列訊息,表示已啟動
//1663是mysqld運行的進程號,可能根據不同系統運行的進程數量而不同
若需要重新啟動MySQL可以使用以下命令之一:
🎜> # /etc/init.d/mysqld restart
````````````````````````````````` ````````````````````
2、資料庫的關閉:
可以使用下列其中一個指令:
# service # /etc/init.d/mysqld stop
# /mysqladmin shutdown
MySQL管理
修改root管理密碼= old_password('密碼');
update mysql.user set password = old_password('密碼') where host = '主機' and 4 🎜>mysqladmin password 'crq'
使用者密碼
對於MySQL密碼可以使用PASSWORD()和ENCRYPT()函數加密
mysql>select PASSWORD()函數加密
mysql 🎜> 註:ENCRYPT()在Windows上不可用
方法三:使用update語句和password()函數將root口令設定為crp。
mysql> update user set password=password('crq')
-> Query OK, 2 row affected (0.09 sec)
Ro手權限設置,因此必須使用客戶端程式mysql環境下的flush privileges指令或使用管理工具mysqladmin的flush-privileges子指令通知伺服器重新載入授權表。
mysql> flush privileges; //此時即生效可使用。
``````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````『 ```````````````````
改變資料庫儲存路徑
在Window下,MySQL的所有資料庫都保存在「%mysqlroor%data」目錄下。
停止MySQL服務
修改%systemroor%my.ini檔案
[mysqld]
datadir=D:/data
將原目錄中的所有檔案和資料夾內容,並全部移至新的目錄D:/data目錄中。
重啟MySQL服務
修改MySQL字元集
找到MySQL設定檔my.ini,通常在C:windowmy.ini。
在my.ini檔案裡面加上「default-character-set=gbk #」或gb2312,utf8
重啟MySQL服務
刪除匿名使用者:
myslq> delete ';
//返回以下訊息,表示匿名使用者刪除成功
Query OK, 2 row affected (0.03 sec)
新增功能的使用者權限:
使用使用者選項:grant,
語法:
GRANT priv_type[(column_list)][,priv_type[(column_list)]…]
🎜> TO user_name [IDENTIFIED BY 'password']
[,user_name [IDENTIFIED BY 'password']…]
BY 'password']…]
英文字元
制定允許該用戶可以存取的資料庫和表
制定允許該用戶對資料庫做什麼的操作
制定允許該用戶從哪些主機/IP進行遠端連線
制定允許該用戶對其他使用者進行授權或取消授權
例如:新增一個可以從本機連線到MySQL伺服器的超級使用者crq,但連線時必須使用口令crqpass
mysql> grant all on *. to crq@localhost identfied by 'crqpass' with grant option;
//返回以下訊息,顯示權限設定成功
Query OK, 0 rows affected Query OK, 0 rows affected Query OK, 0 rows affected Query OK, 0 rows地方連接到MySQL伺服器的超級使用者crq,但連線時必須使用口令crqpass
mysql> grant all on *.* to crq@'%' identified by 'crqpass' witho crq@'%' identified by 'crqpass' with to crq@'%' identified by 'crqpass' with o> 1/2頁 12下一頁
以上就介紹了photoshop學習網站 PHP學習mysql課件 高級篇第1/2頁,包括了photoshop學習網站方面的內容,希望對PHP教程有興趣的朋友有所幫助。