Configure MySQL service_mysql in ubuntu

Source: Internet
Author: User
Configure MySQL service ubuntu in Ubuntu

Step 1 install MySQL

Sudo apt-get install mysql-server

Step 2 configure MySQL

2.1 vim/etc/mysql/my. cnf find bind-address = 127.0.0.1.

2.2 comment out: # bind-address = 127.0.0.1

Or change the IP address to 0.0.0.0: bind-address = 0.0.0.0 to allow access from any IP address.

2.3 restart mysql: sudo/etc/inid. d/mysql restart

Step 3 authorize the user to connect remotely

3.1 log on to mysql: mysql-u root-p, and enter the password to log on

3.2 Authorization

Grant all privileges on *. * to root @ "%" identified by "password" with grant option;

Flush privileges;
The command on the first line is interpreted as follows, *. *: the first * indicates the database name, and the second * indicates the table name. This means that all tables in all databases are authorized to users. Root: Grant the root account. "%": Indicates that the authorized user's IP address can be specified. This indicates that any IP address can access the MySQL database."Password": password corresponding to the allocated account. replace the password with your mysql root account password.


The second command is to refresh the permission information, that is, to make the settings take effect immediately.

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.