Mysql installation, configuration, and remote connection _ MySQL

Source: Internet
Author: User
Mysql installation, configuration, remote connection target is to install mysql on linux, first go to http://dev.mysql.com/downloads/mysql/download, select the platform, I download directly Linux-Generic (glibc 2.5) (x86, 64-bit), RPM Bundle, Which contains both the server and client.

After decompression, run rpm-ivh MySQL-server -***. rpm and rpm-ivhMySQL-client -***. the server and client are successfully installed at rpm. the default configuration file is/usr/my. cnf. you can modify the port number.

Run mysql. server start under/usr/share/mysql/to start mysql.


Follow the prompts to generate a random password for root in/root/. mysql_secret.

1. run the mysql-u root-p random password to enter the mysql console (subsequent commands must end)

2. set password for 'root' @ 'localhost' = password ('000000'); change the password

3. you can log on with a new password;


By default, Mysql only allows local access to settings. if you need an external IP address to connect to mysql (for example, access mysql using mysql workbench ), you need to add related authorization to the "user" table in the mysql database, as follows:

1. grant all on *. * to 'root' @ '192. 16.2.7 'identified by '123 ';

2. flush privileges;

At this time, MySQL workbench can be used on 172.16.2.7 to successfully connect to mysql on the server.

Grant syntax:

Grant permission name (all for all permissions) on database name (* all ). table name (* All) to 'user name to be authorized' @ '%' (% indicates all IP addresses, only one IP address can be written) identified by "password ";

The user table (Host, User, and Password) is used for identity check. The server accepts the connection only when the Host and user columns recorded in the User table match the client Host name and user name and provide the correct password.


You can run the select Host, User from mysql. user; command to view the current User.

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.