Mysql database installation experience summary, mysql Summary

Source: Internet
Author: User

Mysql database installation experience summary, mysql Summary

I added a free-installation version of Mysql to my colleague and added it to the window service. However, there are many problems in the process. I would like to sum up my personal experience and hope that other people will not take a detour.

1) I downloaded the mysql compressed package (without installation package) from my colleague or on the official website ).

2) Next, you need to configure some columns to enable the installation-free Mysql to start in the service. In other words, you can use the net start mysql command to start Mysql.

The following uses the decompressed package to the F: \ mysql directory as an example.

3) Find the my-large.ini in the F: \ mysql directory, copy it, rename it my. ini, also put in the F: \ mysql directory.

4) Find [mysqld] In my. ini and add the following statement:

[Mysqld] basedir = "F: \ mysql \" datadir = "F: \ mysql \ data "# Set the data path (you can see the database name directory created in the mysql database in this directory, of course, the table structure and data are saved in it) default-character-set = gbk # set the mysql Chinese character set, allow mysql to store Chinese characters default-storage-engine = innodb # Set Mysql storage engine to innodb type default-collation = gbk_chinese_ci # Set Chinese sorting and comparison mode # skip networking ignore remote Logon

5) if you use the mysql Command Line (for example, select * from student where name like "%") on the server in the Chinese environment, change the default Character Set of mysql.

default-character-set=gbk

6) Register mysql in the window service so that it can be automatically started when windows is started, or you can use the net start mysql command to start it manually.

Go to the dos black screen, enter the mysql/bin directory, and use mysqld -- install mysql (the mysql alias in the window service, whatever name, you can see this alias in window management> services and applications> services) -- 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 provided, this command allows the server to read from the [mysqld] Group of the standard option file. Because the -- defaults-file option is provided, the server only reads the option from the [mysqld] Group of the named file (my. ini.

7) at this time, the service has been added but cannot be started. You must restart the computer to start it (the default value is automatic). You can set it to manual and Use net start mysql to start it as needed, use net stop mysql to disable the service.

8) after the computer is restarted, set the environment variable and add it to the path. F: \ mysql \ bin enables you to directly enter the mysql Command; otherwise, you must enter F: the command can be used only in the \ mysql \ bin directory.

9) The next step is to delete all users and create a super account (~ O (worker _ worker) O ~), You can also create several accounts with low permissions or change the password (generally, the initial username of mysql is root, and the password is blank ).

10) after the environment variables in step 1 are configured, enable the dos black screen, start the mysql service, run the net start mysql Command, enter the mysql environment, enter mysql-uroot-p, and enter all the keys;

11) The following are a series of operations on users and permissions:

A) change the password with the username as root, and enter use mysql; update user set PASSWORD = PASSWORD ("password") where user = "root"; (here PASSWORD () is a built-in encryption function of mysql)

B) Allow all machines to connect to mysql using the root account (note that skip-networking is not set in 4; otherwise, remote logon is not allowed), use mysql; uodate user set host = "%" where user = "root" and host = "127.0.0.1 ";

C. Only machines with IP addresses 192.168.1.111 can be connected to mysql with the root account. use mysql; uodate user set host = "192.168.1.111" where user = "root" and host = "127.0.0.1 "; or you can create an account for it and grant less permissions to it for security reasons.

D) add an account named aokunsang with the admin password and all permissions.
Use mysql; insert into user (Host, User, Password) values ("localhost", "aokunsang", "admin ");

Grant all privileges on *. * to aokunsang @ localhost;

Finally, refresh the permission table flush privileges;

E) Add a user name named aokunsang and the password named admin. The user has all permissions and can remotely connect to the mysql database. (Only one SQL statement is required)

use mysql;grant all privileges on *.* to 'aokunsang'@'%' identified by "admin" with grant option;

Add a machine that only allows the IP address 192.168.1.111 to connect to mysql:

use mysql;grant all privileges on *.* to 'aokunsang'@'192.168.1.111' identified by "admin" with grant option;

12) Now you can test your Mysql database.

Of course, you can also delete the window service of mysql; command: mysqld -- remove mysql;

The above is a summary of mysql database installation experience provided by Alibaba Cloud. I hope it will be helpful to you. If you have any questions, please leave a message and I will reply to you in a timely manner. Thank you very much for your support for the help House website!

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.