MySQL Database installation experience issues Summary _mysql

Source: Internet
Author: User
Tags mysql in mysql command line

In a colleague that the entire installation version of MySQL, and then add to window services, but there are many problems in the middle, summed up personal experience, I hope others do not detours.

1 in the colleague that or to the official website to download the MySQL compression package (no installation package).

2 Next you need to do some column configuration to make the installation-free MySQL boot in the service, in other words, you can use the net start MySQL command to start.

The following is an example of my decompression package to the F:\mysql directory.

3 in the F:\mysql directory to find My-large.ini, copy it, renamed to My.ini, also placed in the F:\mysql directory.

4 Find [mysqld] in My.ini and add the following statement:

[Mysqld]
Basedir= "F:\mysql\"
datadir= "F:\mysql\data" #设置数据路径 (in this directory, you can see the database named directory built in MySQL databases, of course, the table structure and data are stored)
DEFAULT-CHARACTER-SET=GBK #设置mysql中文字符集, allowing MySQL to store Chinese character
Default-storage-engine=innodb # Set the storage engine for MySQL to InnoDB type
default-collation=gbk_chinese_ci #设置中文排序比较方式
#skip-networking This ignores remote logins

5 change MySQL's default character set if you use the MySQL command line in a Chinese-language server (for example: SELECT * from student where name like "King%").

Default-character-set=gbk

6 register MySQL in the window service to enable it to start automatically when Windows starts, or you can use command net start MySQL to start manually.

Into the DOS black screen, into the Mysql/bin directory, using mysqld--install MySQL (window services in MySQL alias, casually named, you can in the Windows Management-> services and Applications-> services to see this alias)-- Default-file=f:\mysql\my.ini
F:\mysql\bin>mysqld--install MySQL--default-file=f:\mysql\my.ini
If the--defaults-file option is not given, the command allows the server to read from the [mysqld] group of the standard options file. Because the--defaults-file option is provided, the server reads only the options from the [mysqld] group of the named file (that is, My.ini).

7 at this time the service has been added but can not start, you must restart the computer to start (the default is automatic), can be set to manual, when needed with net start MySQL start, with net stop MySQL shutdown services.

8 Restart the computer, first set the environment variables, in the path to add; F:\mysql\bin, so that you can directly enter the MySQL command, otherwise you must enter the F:\mysql\bin directory before you can use the command.

9 The next thing to do is to delete all users, set up an input their own super account (~o (∩_∩) o~), can also establish a number of small permissions of the account, or change the password (the general MySQL initial user name is root, the password is empty).

10 The 8th step of the environment variable configuration, open the DOS black screen, start the MySQL service, command net start MySQL, and then enter the MySQL environment, input mysql-uroot-p, all the way enter the key;

11 The following is a series of actions on users and permissions:

A to modify the password with user name root, enter the use mysql;update user set password = password ("password") where user = "root";(here in console password () is a built-in cryptographic function of MySQL)

b) Allow all machines to connect to MySQL using the root account (note that no skip-networking is set in 4, you cannot log on remotely), use Mysql;uodate user set host= "%" where user = "root" and Host = "127.0.0.1";

c only allow IP address for 192.168.1.111 machine use root account to connect to Mysql,use mysql;uodate user set host= "192.168.1.111" Where user = "root" and host = " 127.0.0.1 "or you can create a new account for him, give fewer privileges, for security reasons.

D add an account for Aokunsang, password admin, all permissions for the user.
Use MySQL; Insert into User (Host,user,password) VALUES ("localhost", "Aokunsang", "admin");

Authorization Permission: Grant all privileges on *.* to aokunsang@localhost;

Finally, the Refresh Permission table flush privileges;

E Add a username of Aokunsang, password admin, with all permissions, and can remotely connect to the MySQL database. (only one SQL statement is required)

Use Mysql;grant all privileges in *.* to ' aokunsang ' @ '% ' identified by ' admin ' with GRANT option;

Add a computer that only allows IP addresses for 192.168.1.111 to connect to MySQL:

Use Mysql;grant all privileges in *.* to ' Aokunsang ' @ ' 192.168.1.111 ' identified by ' admin ' with GRANT option;

12 Now you are ready to test your MySQL database.

Of course you can also delete the MySQL window service; command: mysqld--remove MySQL;

The above is a small set to introduce the MySQL database installation experience problem summary, I hope to help you, if you have any questions please give me a message, small set will promptly reply to everyone. Here also thank you very much for the cloud Habitat Community website support!

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.