mysql教案 MySql經典筆記教案 doc

2021-10-25 14:47:26 字數 2032 閱讀 5148

--zhouwf0726

2007-06-5

mysql安裝

mysql命令規則介紹:

mysql的命名機制使用由3個數字和乙個字尾組成的版本號。例如,像mysql-5.0.27-beta的版本號這樣解釋:

第1個數字(5)是主版本號,描述了檔案格式。所有版本5的發行都有相同的文

件格式。

第2個數字(0)是發行級別。主版本號和發行級別組合便構成了發行序列號。

第3個數字(9)是在此發行系列的版本號,隨每個新分發版遞增。通常你需要已

經選擇的發行(release)的最新版本(版本)。

mysql安裝:

mysql-5.0.27-win32.zip

mysql-noinstall-6.0.0-alpha-win32.zip

安裝後檔案布局:

在windows中,mysql 5.1的預設安裝目錄是c:\program files\mysql\mysql server 5.1。(一些windows使用者寧願安裝到原來的預設安裝目錄 c:\mysql。然而,子目錄布局仍然相同)。安裝目錄包括以下子目錄:

目錄目錄內容

bin客戶端程式和mysqld伺服器

data

日誌檔案,資料庫

docs

文件examples

示例程式和指令碼

include

包含(頭)檔案

lib庫

scripts

實用工具指令碼

share

錯誤訊息檔案

登入及一些基本操作

本章的主要目的是讓我們對mysql的基礎框架有個大概的了解。

連線與斷開mysql伺服器

安裝完畢登陸mysql(有過一些其他資料庫基礎的人都應該很容易使用這幾步):

我們可以利用如下引數檢視mysql命令的幫助:

c:\program files\mysql\mysql server 5.0\bin>mysql –help

聯接mysql伺服器:

c:\program files\mysql\mysql server 5.0\bin>mysql -h localhost -uroot -p888888

welcome to the mysql monitor. commands end with ; or \g.

your mysql connection id is 22 to server version: 5.0.27-community-nt

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

mysql> show databases;

| database |

| information_schema |

| mysql |

| root |

3 rows in set (0.08 sec)

安裝完畢,都會有這幾個預設的資料庫。

注意到目前沒有連線到任何資料庫。

mysql> select database();

| database() |

| null |

1 row in set (0.78 sec)

mysql> quit

bye我們也可以在連線mysql伺服器的時候指定想要連線的資料庫,如下:

c:\program files\mysql\mysql server 5.0\bin>mysql --user=root -p mysql

enter password: ******

welcome to the mysql monitor. commands end with ; or \g.

your mysql connection id is 7 to server version: 5.0.27-community-nt

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

mysql> select database();

| database() |

mysql實踐教程 教案 Mysql基礎操作實踐

介紹mysql基本的增刪查改語句的實踐,沒有難度,孰能生巧。首先我們隨便建立一張庫和表 mysql create database test1 mysql create table disc info id int 5 not null auto increment,disc name varcha...

mysql 經典問題 mysql經典排名問題

問題 編寫乙個 sql 查詢來實現評分排名。如果兩個分數相同,則兩個分數排名 rank 相同。評分表ratings 方法一 不運用dense rank 運用子查詢 解決這一問題可以分為兩個步驟 步驟一 降序排列分數 select a.rating as rating from ratings a o...

mysql經典應用架構 MySQL經典架構

mysql主從複製 此種架構,一般初創企業比較常用,也便於後面步步的擴充套件 此架構特點 1 成本低,佈署快速 方便 2 讀寫分離 3 還能通過及時增加從庫來減少讀庫壓力 4 主庫單點故障 5 資料一致性問題 同步延遲造成 mysql mmm架構 通過 drbd 基於 block 塊的複製模式,快速...