• notice
  • Congratulations on the launch of the Sought Tech site

Mysql database installation experience summary

I made an installation-free version of Mysql at my colleague, and then added it to the window service, but there were many problems in the middle.I summarize my personal experience and hope that others will not make detours.

1) The compressed package of mysql (installation-free package) is downloaded from a colleague or from the official website.

2) Next, you need to perform a series of configurations to enable the installation-free Mysql to start in the service, in other words you can use net start mysql command starts.

The following is an example of extracting the compressed package to the F:\mysql directory.

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

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

datadir="F:\mysql\data" #Set the data path (you can see the directory named database created in the mysql database in this directory, of course, the table structure and data are stored in it)
default-character-set=gbk #Set mysql Chinese character set, so that mysql can store Chinese characters
default-storage-engine=innodb #Set Mysql storage engine to innodb type
default-collation=gbk_chinese_ci #Set Chinese sorting comparison method
#skip-networking This sentence will ignore remote login

5) If you use the mysql command line (for example: select * from student where name like "王%") in the server in the Chinese environment, change the default character set of mysql.


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

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

7) At this time, the service has been added but cannot be started.The computer must be restarted to start (automatic by default).It can be set to manual.Use net start mysql to start when needed, and net stop mysql to close the service.

8) After restarting the computer, first set the environment variables and add in the path; F:\mysql\bin, enable to directly enter the mysql command, otherwise you must first enter the F:\mysql\bin directory before you can use the command.

9) The next thing to do is to delete all users, create a super account to enter your own (~O(∩_∩)O~), you can also create several accounts with small permissions, or change the password (generally The initial user name of mysql is root and the password is empty).

10) After the environment variables of step 8 are configured, turn on the dos black screen, start the mysql service, and command net start mysql; then enter the mysql environment, enter mysql -uroot -p, and enter the key all the way;

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

a) Modify the password of the user name root, enter use mysql in the console; update user set password = PASSWORD("PASSWORD") where user = "root"; (here PASSWORD() is a built-in encryption function of mysql )

b) Allow all machines to use the root account to connect to mysql (note that skip-networking is not set in 4, otherwise you cannot log in remotely), use mysql;uodate user set host="%" where user = "root" and host = "";

c) Only the machine with the ip address is allowed to use the root account to connect to mysql, use mysql; uodate user set host="" where user = "root" and host =""; Or you can create a new account for him and give him less permissions, just for safety's sake.

d) Add a user with account aokunsang, password admin, and all permissions.
use mysql; insert into user(Host,User,Password) values("localhost","aokunsang","admin");

Authorization authority: grant all privileges on *.* to [email protected];

Finally, refresh the privilege table flush privileges;

e) Add a user name aokunsang, password admin, have 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 ip address to connect to mysql:

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

12) Now you can test your Mysql database.

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

The above is a summary of the mysql database installation experience that the editor introduced to you.I hope it will be helpful to you.If you have any questions, please leave a message to me.The editor will reply to you in time.Thank you very much for your support to the website!


Technical otaku

Sought technology together

Related Topic


Leave a Reply