程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 數據庫知識 >> MYSQL數據庫 >> 關於MYSQL數據庫 >> 我的mysql授課大綱,希望對大家有用 作者:chu888

我的mysql授課大綱,希望對大家有用 作者:chu888

編輯:關於MYSQL數據庫
 1、 安裝和啟動
安裝mysql可以通過freebsd自帶的port來安裝,在/stand/sysinstall中來選擇,選擇configure中的packages.安裝之後,mysql的所有安裝文件都被安裝在了/usr/local中.MySQL在第三張盤和第四張盤裡面都有。

啟動MySQL的服務器
chu888# cd /usr/local/etc/rc.d
chu888# ls
00mysql-clIEnt.sh MySQL-server.sh
chu888# ./MySQL-server.sh start

使用MySQL的客戶端

chu888# cd /usr/local/bin
chu888# ls my*
my_print_defaults MySQLAccess
myisamchk MySQLadmin
myisamlog MySQLbinlog
myisampack MySQLbug
mysql MySQLcheck
mysql_config MySQLd_multi
mysql_convert_table_format MySQLdump
mysql_find_rows MySQLdumpslow
mysql_fix_privilege_tables MySQLhotcopy
mysql_install_db MySQLimport
mysql_setpermission MySQLshow
mysql_zap MySQLtest
chu888# ./MySQL
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2 to server version: 3.23.47

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

MySQL>

如果看到這個MySQL>的提示符,說明你以可以使用這個數據庫了。

2 MySQL管理
首先我們應該認識以下幾個應用程序:
MySQL是一個交互式的程序,允許將SQL語句發布到服務器上並浏覽其結果
MySQLadmin一個管理程序,允許執行諸如關閉服務器以及創建或刪除數據庫的工作
isamchk和myisamchk這些實用程序將幫助你完成表的分析和優化,以及在表損壞時進行崩潰恢復。
MySQLdump一個工具,用於備份或將數據庫拷貝到另一個服務器中
3 數據庫目錄的位置
可以使用MySQLadmin直接得到
chu888# ./MySQLadmin variables

4 MySQL數據表的表示法
格式文件 .frm 描述表的結構
數據文件 .isd或.myd 包含表的數據
索引文件 .isd或.myi索引文件

5 關閉數據庫
chu888#./MySQLadmin shutdown

6 備份數據庫
chu888#MySQLdump samp_db>/usr/tmp/samp_db.2002

7 恢復數據庫
chu888#MySQLdump samp_db
8 修改數據庫的密碼
chu888# ./MySQLadmin -uroot -p passWord '123456'
chu888# ./MySQL -h localhost -uroot -p
Enter passWord:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2 to server version: 3.23.47

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

MySQL>

MySQL的最基本使用
chu888# ./MySQL -uroot -p
Enter passWord:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 6 to server version: 3.23.47

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved