First, download, here Use the green uncompressed version
Http://mirror.services.wisc.edu/mysql/Downloads/MySQL-5.1/mysql-noinstall-5.1.32-win32.zip
Second, the configuration of MySQL parameters
1, unzip the green version of the software to D:\AppServ\MySQL
Set system environment variables, adding in Path D:\AppServ\MySQL\bin;
2, modify D:\AppServ\MySQL\my-small.ini file content, add red content
[Client]
#password = Your_password
Port = 3306
Socket =/tmp/mysql.sock
Default-character-set=gbk
[Mysqld]
Port = 3306
Socket =/tmp/mysql.sock
Default-character-set=gbk
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
Basedir=d:\appserv\mysql\
Datadir=d:\appserv\mysql\data\
#basedir是mysql安装目录; #datadir是mysql数据库存放位置, must be the Data folder name
Save the modified file as My.ini
3, the installation of MySQL services, the service name of their own definition of MySQL.
1), enter the DOS window
2), the implementation of the installation of the MySQL service name command:
D:\AppServ\MySQL\bin\mysqld-nt-install MySQL--defaults-file= "D:\Appserv\MySQL\my.ini"
There is a service successfully installed. Indicates a successful installation.
Then open the Service window (enter services.msc in the Run box to open the service window, and then you can find the MySQL service, right key MySQL service properties, in the pop-up window you can see the following information:)
D:\AppServ\MySQL\bin\mysqld-nt--defaults-file=d:\appserv\mysql\my.ini MySQLIt means MySQL will start with boot up!
3), start the MySQL service
net start MySQL
The MySQL service is starting.
The MySQL service failed to start.
4), login MySQL server
Mysql-uroot-p
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>
Note: The administrator username for MySQL is root and the password defaults to null.
5), view the database
Mysql>show databases;
+--------------------+
| Database |
+--------------------+
| Information_schema |
| MySQL |
| Test |
+--------------------+
3 Rows in Set (0.02 sec)
You can see that there are three databases in the MySQL server.
6), using the database
Mysql>Use test
Database changed
7), view the tables in the database
Mysql>Show tables;
Empty Set (0.00 sec)
8), CREATE TABLE TTT
Mysql>CREATE TABLE TTT (a int,b varchar (20));
Query OK, 0 rows Affected (0.00 sec)
9), insert three piece of data
Mysql>INSERT into TTT values (1, ' AAA ');
Query OK, 1 row affected (0.02 sec)
Mysql>INSERT into TTT values (2, ' BBB ');
Query OK, 1 row Affected (0.00 sec)
Mysql>INSERT into TTT values (3, ' CCC ');
Query OK, 1 row Affected (0.00 sec)
10), query data
Mysql>SELECT * from TTT;
+------+------+
| A | B |
+------+------+
| 1 | AAA |
| 2 | BBB |
| 3 | CCC |
+------+------+
3 Rows in Set (0.00 sec)
11), delete data
Mysql>Delete from TTT where a=3;
Query OK, 1 row affected (0.01 sec)
After delete query operation result:
Mysql>SELECT * from TTT;
+------+------+
| A | B |
+------+------+
| 1 | AAA |
| 2 | BBB |
+------+------+
2 rows in Set (0.00 sec)
12), update the data
Mysql>Update TTT Set b = ' xxx ' where a = 2;
Query OK, 1 row Affected (0.00 sec)
Rows matched:1 changed:1 warnings:0
To view the updated results:
Mysql>SELECT * from TTT;
+------+------+
| A | B |
+------+------+
| 1 | AAA |
| 2 | xxx |
+------+------+
2 rows in Set (0.00 sec)
13), Delete table
Mysql>drop table TTT;
Query OK, 0 rows Affected (0.00 sec)
To view the remaining tables in the database:
Mysql>Show tables;
Empty Set (0.00 sec)
third, change the MySQL database root user password
1. Use MySQL Database
Mysql>Use MySQL
Database changed
2. View all tables in MySQL database
Mysql>Show tables;
+---------------------------+
| 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 |
+---------------------------+
Rows in Set (0.00 sec)
3, delete all the data of the user table in the MySQL database
Mysql>Delete from user;
Query OK, 3 Rows Affected (0.00 sec)
4, create a root user, the password is "Xiaohui".
Mysql>Grant all on *.* to root@ '% ' identified by ' Xiaohui ' with GRANT option;
Query OK, 0 rows affected (0.02 sec)
5. View users in the user table
Mysql>Select User from user;
+------+
| User |
+------+
| Root |
+------+
1 row in Set (0.00 sec)
6, restart MySQL: Changes to the MySQL user, the need to restart the MySQL server before it can take effect.
net stop MySQL
The MySQL service is stopping.
The MySQL service has stopped successfully.
net start MySQL
The MySQL service is starting.
The MySQL service has started successfully.
7. Re-login MySQL server
Mysql-uroot-pxiaohui
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>
If you modify the password after net Startmysql a 1067 error that does not start MySQL, you can resolve it by using the following methods:
Use cmd command: D:\Appserv\mysql\bin\mysqladmin-uroot-p shutdown, then enter the password, and then net start MySQL without this error hint!
Iv. creation and deletion of database
1. Create DATABASE TestDB
Mysql>CREATE DATABASE TestDB;
Query OK, 1 row affected (0.02 sec)
2. Using Database TestDB
mysql> use TestDB;
Database changed
3. Delete database TestDB
mysql> drop database testdb;
Query OK, 0 rows Affected (0.00 sec)
4, exit the landing
Mysql>exit
Bye
C:\Documents and Settings\administrator>
V. General steps to manipulate database data
1, start the MySQL server
2, log on to the database server
3, the use of a database to operate
4, the operation of the table in the database, can be deleted and modified to check various operations.
5, exit the landing.