MySQL 綠色版安裝方法圖文教程

mysql 綠色版安裝方法教程,需要的朋友可以參考下。

一、下載,這里使用綠色解壓縮版

二、配置MySQL的參數

1、解壓縮綠色版軟件到D:AppServMySQL
設置系統環境變量, 在Path中添加

2、修改D:AppServMySQLmy-small.ini文件內容,添加紅色內容

[client]
#password = your_password
port = 3306
socket = /tmp/mysql.sock

[mysqld]
port = 3306
socket = /tmp/mysql.sock

skip-locking
key_buffer = 16K
max_allowed_packet = 1M
table_cache = 4
sort_buffer_size = 64K
read_buffer_size = 256K
read_rnd_buffer_size = 256K
net_buffer_length = 2K
thread_stack = 64K

將修改后的文件另存為my.ini

3、安裝MySQL的服務,服務名自己定義為MySQL.
1)、進入DOS窗口
2)、執行安裝MySQL服務名的命令:

出現Service successfully installed.表示安裝成功。

然后打開服務窗口(在運行框中輸入services.msc即可打開服務窗口,然后可以找到mysql服務了,右鍵mysql服務屬性,在彈出的窗口中可以看到以下信息:)
則表示mysql會隨開機啟動而啟動!

3)、啟動MySQL服務

MySQL服務正在啟動 .
MySQL服務無法啟動。

4)、登陸MySQL服務器

Enter password:
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 1
Server version: 5.1.32-community MySQL Community Edition (GPL)

Type ‘help;’ or ‘h’ for help. Type ‘c’ to clear the buffer.

mysql>

注意:MySQL的管理員用戶名為root,密碼默認為空。

5)、查看數據庫
mysql>
+——————–+
| Database |
+——————–+
| information_schema |
| mysql |
| test |
+——————–+
3 rows in set (0.02 sec)

可以看到MySQL服務器中有三個數據庫。

6)、使用數據庫
mysql>
Database changed

7)、查看數據庫中的表
mysql>
Empty set (0.00 sec)

8)、創建表ttt
mysql>
Query OK, 0 rows affected (0.00 sec)

9)、插入三條數據
mysql>
Query OK, 1 row affected (0.02 sec)

mysql>
Query OK, 1 row affected (0.00 sec)

mysql>
Query OK, 1 row affected (0.00 sec)

10)、查詢數據
mysql>
+——+——+
| a | b |
+——+——+
| 1 | aaa |
| 2 | bbb |
| 3 | ccc |
+——+——+
3 rows in set (0.00 sec)

11)、刪除數據
mysql>
Query OK, 1 row affected (0.01 sec)

刪除后查詢操作結果:
mysql>
+——+——+
| a | b |
+——+——+
| 1 | aaa |
| 2 | bbb |
+——+——+
2 rows in set (0.00 sec)

12)、更新數據
mysql>
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0

查看更新結果:
mysql>
+——+——+
| a | b |
+——+——+
| 1 | aaa |
| 2 | xxx |
+——+——+
2 rows in set (0.00 sec)

13)、刪除表
mysql>
Query OK, 0 rows affected (0.00 sec)

查看數據庫中剩余的表:
mysql>
Empty set (0.00 sec)

三、更改MySQL數據庫root用戶的密碼

1、使用mysql數據庫
mysql>
Database changed

2、查看mysql數據庫中所有的表
mysql>
+—————————+
| Tables_in_mysql |
+—————————+
| columns_priv |
| db |
| func |
| help_category |
| help_keyword |
| help_relation |
| help_topic |
| host |
| proc |
| procs_priv |
| tables_priv |
| time_zone |
| time_zone_leap_second |
| time_zone_name |
| time_zone_transition |
| time_zone_transition_type |
| user |
+—————————+
17 rows in set (0.00 sec)

3、刪除mysql數據庫中用戶表的所有數據
mysql>
Query OK, 3 rows affected (0.00 sec)

4、創建一個root用戶,密碼為”xiaohui”。
mysql>
Query OK, 0 rows affected (0.02 sec)

5、查看user表中的用戶
mysql>
+——+
| User |
+——+
| root |
+——+
1 row in set (0.00 sec)

6、重啟MySQL:更改了MySQL用戶后,需要重啟MySQL服務器才可以生效。

MySQL 服務正在停止..
MySQL 服務已成功停止。

MySQL 服務正在啟動 .
MySQL 服務已經啟動成功。

7、重新登陸MySQL服務器

Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 1
Server version: 5.1.32-community MySQL Community Edition (GPL)
Type ‘help;’ or ‘h’ for help. Type ‘c’ to clear the buffer.
mysql>

如果修改密碼后net startmysql出現不能啟動mysql的1067錯誤,則可以使用以下辦法解決:
使用cmd命令:D:Appservmysqlbinmysqladmin -uroot -p shutdown,然后輸入密碼,再net start mysql 就沒有這個錯誤提示了!

四、數據庫的創建與刪除

1、創建數據庫testdb
mysql>
Query OK, 1 row affected (0.02 sec)

2、使用數據庫testdb
mysql>
Database changed

3、刪除數據庫testdb
mysql>
Query OK, 0 rows affected (0.00 sec)

4、退出登陸
mysql>
Bye

C:Documents and SettingsAdministrator>

五、操作數據庫數據的一般步驟

1、啟動MySQL服務器
2、登陸數據庫服務器
3、使用某個要操作的數據庫
4、操作該數據庫中的表,可執行增刪改查各種操作。
5、退出登陸。

? 版權聲明
THE END
喜歡就支持一下吧
點贊5 分享