MySQL installation experience.

Source: Internet
Author: User
Tags mysql command line

In the colleague that the entire install version of MySQL, and then added to the window service, but there are a lot of problems in the middle, summed up personal experience, I hope others do not detour.

1) in the colleague or go to the official website to download the MySQL compressed package (free installation package).
2) Next, you need to configure some columns to enable the free-install MySQL to start in the service, in other words, you can start with the net start MySQL command.
Here's an example of extracting the compressed package into the F:\mysql directory.
3) Locate the My-large.ini in the F:\mysql directory, copy it, rename it to My.ini, and place it in the F:\mysql directory.
4) Locate [mysqld] in My.ini and add the following statement:
[Mysqld]
Basedir= "F:\mysql\"
Datadir= "F:\mysql\data" #设置数据路径 (you can see in this directory the MySQL database created by the name of the directory, of course, the table structure and data are saved)
DEFAULT-CHARACTER-SET=GBK #设置mysql中文字符集 so that MySQL can store Chinese characters
Default-storage-engine=innodb #设置Mysql的存储引擎为innodb类型
Default-collation=gbk_chinese_ci #设置中文排序比较方式
#skip-networking This sentence will ignore Telnet
5) If the MySQL command line is used in a Chinese-language server (for example: SELECT * from student where name is like "Wang%"), change the MySQL default character set.
Default-character-set=gbk
6) Register MySQL with the window service to enable it to start automatically when Windows starts, or you can start manually by using command net start MySQL.
Enter the DOS black screen, enter the Mysql/bin directory, use the mysqld--install MySQL (window service MySQL alias, casually named, you can see in window's management--services and applications--services) 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, this command allows the server to read from the [mysqld] group of the standard options file. Because the--defaults-file option is available, the server only reads the option 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, you must restart the computer to start (the default is automatic), can be set to manual, when needed with net start MySQL startup, with net stop MySQL shutdown service.
8) After restarting the computer, set the environment variables, add in path; F:\mysql\bin, enable direct input to 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 a user to enter their own super account (~o (∩_∩) o~), you can also set up a few permissions small account, or change the password (general MySQL initial user name is root, password is empty).
10) The 8th step of the environment variable configuration, turn on the DOS black screen, start the MySQL service, command net start MySQL, and then enter the MySQL environment, enter mysql-uroot-p, all the way enter key;
11) Here are a series of actions for users and permissions:
A) modify the username root password, enter use mysql;update user set password = password ("password") in console, where user = "root";(here password () is a built-in cryptographic function for MySQL)
b) Allow all machines to connect to MySQL using the root account (note that skip-networking is not set in 4, otherwise you cannot telnet), use Mysql;uodate user set host= "%" where user = "root" and Host = "127.0.0.1";
c) only allow machines with IP address 192.168.1.111 to connect to mysql,use mysql;uodate user set host= "192.168.1.111" Where user = "root" and "host =" Using the root account 127.0.0.1 "; or you can create a new account for him, giving less authority, for security reasons.
d) Add an account for Aokunsang, password for 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[email protected];
Finally, refresh the Permissions table flush privileges;
e) Add a username of Aokunsang, password is admin, have all permissions, and can connect to MySQL database remotely. (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 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 MySQL window service; the command is: mysqld--remove MySQL;

MySQL installation experience.

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.