MySQL service added to Window system service

Source: Internet
Author: User
Tags mysql version

MySQL installation configuration (win7 64-bit)

Turn, tidy.

MySQL version is

Mysql-noinstall-5.1.66-winx64.zip (free installation version)

Mysql-workbench-gpl-5.2.44-win32.msi

mysql-connector-java-5.1.22

The MySQL configuration database is encoded as UTF-8 (specified in My.ini).

1 installation

First extract the Mysql-noinstall-5.1.66-winx64.zip to D:\appspace\mysql

Move the Data folder to D:/appspace/mysqldata that is the data path for MySQL: d:/appspace/mysqldata/data

The My.ini configuration file has 2 selectable locations:

Open E:\appSpace\mysql \ My-large.ini (if there is a 1067 error in the back of MySQL, you can try to use My-huge.ini or other), add the following lines at the end and Save as My.ini (C:\Windows ).

#--------------------------------------------------------

[Mysqld]

Basedir=d:/appspace/mysql

Datadir=d:/appspace/mysqldata/data

Default-character-set=utf8

[Winmysqladmin]

Server=d:/appspace/mysql/bin/mysqld.exe

#default-character-set=utf8

[Client]

Default-character-set=utf8

#--------------------------------------------------------

You can view the set character set in MySQL (Be sure to set the Utf-8 in [mysqld]):

Mysql> Show variables like ' character% ';

+--------------------------+-----------------------------------+

| variable_name | Value |

+--------------------------+-----------------------------------+

| character_set_client | UTF8 |

| character_set_connection | UTF8 |

| Character_set_database | UTF8 |

| Character_set_filesystem | binary |

| Character_set_results | UTF8 |

| Character_set_server | UTF8 |

| Character_set_system | UTF8 |

| Character_sets_dir | d:\appspace\mysql\share\charsets\ |

+--------------------------+-----------------------------------+

2 Configuration service (command line must run as Administrator)

1) Add MySQL to the service.

Enter CMD in Windows run with prompt (Cmd.exe), right-click Cmd.exe, select Run as Administrator, enter path: d:/appspace/mysql/bin>

Input mysqld--install MySQL--defaults-file= "C:\Windows\my.ini"

You want to specify Defaults-file.

Enter services.msc in the command line and you can see that MySQL has been added to the services

The content in Path to executable is

D:\appspace\mysql\bin\mysqld--defaults-file=c:\windows\my.ini MySQL

2) Start MySQL

Click the Start button in the MySQL service, or enter net start MySQL in the command line (Run as Administrator).

If a 1067 error occurs and the boot is not available, recheck the My.ini file (described earlier)

3) Turn off MySQL

Click the Stop button in the MySQL service, or enter net stop MySQL in the command line (Run as Administrator).

4) Delete MySQL service

Mysqld–remove

3 Environment variables

Add the d:\appspace\ mysql\bin to the path.

4 operation

Log in to the database:

C:\users\zhang10>mysql-u root-p

Enter Password: * * * (password initial value can be set to root or empty)

After entering MySQL, the command ends with a semicolon.

Show all the database schemas:

mysql> show databases;

Create a new database schema, specifying the encoding utf-8, otherwise garbled.

Create database md11uft8 character set UTF8;

Select this database Md11utf8:

mysql> use Md11utf8;

Create a table:

Mysql> CREATE TABLE basicinfo (ID int primary key auto_increment, name varchar (+) NOT NULL, age int. NOT NULL);

Insert data:

mysql> INSERT into Basicinfo (ID, name, age) VALUES (' 1 ', ' Zhang San ', ' 30 ');

mysql> INSERT into Basicinfo (ID, name, age) VALUES (' 3 ', ' John Doe ', ' 25 ');

Inquire:

Mysql> select * from Basicinfo;

+----+------+-----+

| ID | name | Age |

+----+------+-----+

|      1 |  | 30 |

|      3 |  | 25 |

+----+------+-----+

You can see that the value in name is not displayed (Chinese is not displayed).

When you insert a value in MySQL Workbench, the query is displayed correctly.

However, the query display in the command line is garbled (DOS does not support UTF8 from MySQL), resolved as follows:

mysql> set names GBK;

To change the root password:

Mysql>use MySQL;

Mysql>update user Set Password=password (' NewPassword ') where user= ' root ';

Mysql>flush privileges;

In addition MySQL's Learning website:

Http://dev.mysql.com/doc/refman/5.1/zh/tutorial.html#entering-queries

MySQL Workbench:

Start MySQL First: Enter net start MySQL in the command line (Run as Administrator).


MySQL service added to Window system service

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.