MySQL Green Edition Installation Method graphic tutorial

Source: Internet
Author: User

I. Download. Here we use the green decompressed version.

Http://mirror.services.wisc.edu/mysql/Downloads/MySQL-5.1/mysql-noinstall-5.1.32-win32.zip

2. Configure MySQL Parameters

1. decompress the green software to D: \ AppServ \ MySQL.
Set system environment variables and add D: \ AppServ \ MySQL \ bin to Path;

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 = 16 K
Max_allowed_packet = 1 M
Table_cache = 4
Sort_buffer_size = 64 K
Read_buffer_size = 256 K
Read_rnd_buffer_size = 256 K
Net_buffer_length = 2 K
Thread_stack = 64 K
Basedir = D: \ Appserv \ MySQL \
Datadir = D: \ Appserv \ MySQL \ Data \
# Basedir is the mysql installation directory; # datadir is the mysql database storage location, which must be the Data folder name

Save the modified file as my. ini.

3. Install the MySQL service. The service name is defined as MySQL.
1) enter the DOS window
2) run the command to install the MySQL service name:
D: \ AppServ \ MySQL \ bin \ mysqld-nt-install mysql -- defaults-file = "D: \ Appserv \ MySQL \ my. ini"
The Service successfully installed is displayed. The installation is successful.

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-click mysql Service Properties and you will see the following information in the pop-up window :)
D: \ AppServ \ MySQL \ bin \ mysqld-nt -- defaults-file = D: \ Appserv \ MySQL \ my. ini mysql indicates that mysql will start with startup!

3) Start the MySQL Service
Net start mysql
MySQL service is starting.
The MySQL service cannot be started.

4) log on to the 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 MySQL administrator username is root, and the password is blank by default.

5) view the database
Mysql> show databases;
+ -------------------- +
| Database |
+ -------------------- +
| Information_schema |
| Mysql |
| Test |
+ -------------------- +
3 rows in set (0.02 sec)

The MySQL server has three databases.

6) use the database
Mysql> use test
Database changed

7) View tables in the database
Mysql> show tables;
Empty set (0.00 sec)

8) create a table ttt
Mysql> create table ttt (a int, B varchar (20 ));
Query OK, 0 rows affected (0.00 sec)

9) insert three data items
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)

Query operation results after deletion:
Mysql> select * from ttt;
+ ------ +
| A | B |
+ ------ +
| 1 | aaa |
| 2 | bbb |
+ ------ +
2 rows in set (0.00 sec)

12) update 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

View the update result:
Mysql> select * from ttt;
+ ------ +
| A | B |
+ ------ +
| 1 | aaa |
| 2 | xxx |
+ ------ +
2 rows in set (0.00 sec)

13) delete a table
Mysql> drop table ttt;
Query OK, 0 rows affected (0.00 sec)

View the remaining tables in the database:
Mysql> show tables;
Empty set (0.00 sec)

3. change the password of the root user of the MySQL database

1. Use the mysql database
Mysql> use mysql
Database changed

2. view all tables in the 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 |
+ --------------------------- +
17 rows in set (0.00 sec)

3. Delete all user table data in mysql database
Mysql> delete from user;
Query OK, 3 rows affected (0.00 sec)

4. Create a root user with the password "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: After the MySQL user is changed, the MySQL server needs to be restarted to take effect.
Net stop mysql
MySQL service is stopping ..
The MySQL service has been stopped successfully.

Net start mysql
MySQL service is starting.
The MySQL service has been started successfully.

7. log on to the MySQL server again.
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 the "net startmysql" 1067 error cannot be started after the password is changed, you can use the following solution:
Run the cmd command: D: \ Appserv \ mysql \ bin \ mysqladmin-uroot-p shutdown, enter the password, and then run the net start mysql command!

Iv. Create and delete Databases

1. Create a database testdb
Mysql> create database testdb;
Query OK, 1 row affected (0.02 sec)

2. Use the database testdb
Mysql> use testdb;
Database changed

3. Delete the database testdb
Mysql> drop database testdb;
Query OK, 0 rows affected (0.00 sec)

4. log out
Mysql> exit
Bye

C: \ Documents ents and Settings \ Administrator>

5. General steps for operating database data

1. Start the MySQL server
2. log on to the Database Server
3. Use a database to be operated
4. Operate the tables in the database and perform addition, deletion, modification, and query operations.
5. log out.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.