How to install MySQL and set remote connection in Debian

Source: Internet
Author: User
Operating system: DebianGNU/Linux5.0.7 (lenny) Operation Command: lsb_release-amysql: mysqlVer14.12Distrib5.0.51a, fordebian-linux-gnu (IMG) usingreadline5.2 operation command: mysql-V (note V capital) Step 1: modify/etc/mysql

Operating system: Debian GNU/Linux 5.0.7 (lenny)

Operation Command: lsb_release-

Mysql:MysqlVer 14.12 Distrib 5.0.51a, fordebian-linux-gnu (IMG) using readline 5.2

Command: mysql-V (note that V is capitalized)

Step 1:

Modify the configuration of/etc/mysql/my. conf bind-address. before modification, set bind-address = 127.0.0.1.

I would like Mysql to allow only the local machine for data security. now I want to allow remote machines to access the MySQL database service by modifying bind-address, there are two ways to modify the data:

1. bind-address = 0.0.0.0

Explanation: 0.0.0.0 is the address description of all unknown ip addresses in windows, including the ip address obtained by dhcp of the NIC, pppoe ip address, and other ip addresses not specified on the local machine.

0.0.0.0 is a zero-bandwidth network that represents the default network. it helps the router send packets that cannot be queried in the routing table. If no network route is configured, all packages that cannot be queried in the routing table will be sent to the route for all networks.
2. comment out the bind-address line directly.

# Bind-address = 127.0.0.1

3./etc/init. d/mysql restart // restart the mysql service

Step 2: authorize remote access
1./etc/init. d/mysql stop (stop MySQL)
2. mysqld_safe -- user = mysql -- skip-grant-tables -- skip-networking & (start the mysql service in non-authenticated mode)
3. mysql-u root-p mysql (log on to mysql)
4. the system prompts you to enter the password. press enter to enter the password, that is, use an empty password.
5. grant all on *. * TO 'root' @ '%' identified by 'Your passwordhere 'with grant option; (this is TO authorize access TO the mysql database from any machine using the root user)

Note that the drop-through is shown in figure 5. here is your mysqlroot password, provided that you use the root account to connect to your mysql. If an error occurs, you will receive the following error.

ERROR 1290 (HY000): The MySQL server is running with the -- skip-grant-tables option so it cannot execute this statement

6. quit;
7./etc/init. d/mysql restart // restart the mysql service
After these two steps, the mysql server can be remotely accessed.

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.