您的位置:首页 > 数据库 > MySQL

How to access remote mysql

2009-09-01 11:04 357 查看

Quote:

http://benrobb.com/2007/01/15/howto-remote-root-access-to-mysql/

Howto: Remote Root Access to MySql

Very
quickly, another thing that I typically like to do on my server boxes
is allow root access to my Mysql database from remote computers. I
don’t forward the port through my router and I use a very secure
password (doesn’t everyone?). I don’t want to create a security risk, I
just want to connect to the database from other computers around my
network – particularly from my laptop.

Again (like most of my instructions) these instructions are for Ubuntu – currently Edgy Eft.

sudo apt-get install mysql-server


Ubuntu installs Mysql at /etc/mysql/ by default. Now we need to set a root password.

mysql -u root

mysql> SET PASSWORD FOR 'ROOT'@'LOCALHOST"

> = PASSWORD('new_password');


Now while we’re still here, we’ll create a new HOST for root and allow root to login from anywhere.

mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'

> IDENTIFIED BY 'password' WITH GRANT OPTION;

mysql> FLUSH PRIVILEGES;

mysql> exit


Thanks to Thom for the Flush Privileges comment. I think it depends
on other settings in your MySQL setup, since I didn’t have to, but just
in case, I’ve added it here. We’re almost done now. We just have to
tell Mysql to allow remote logins.

sudo vi /etc/mysql/my.cnf


Out-of-the-box, MySQL only allows connections from the localhost
identified by the IP Address of 127.0.0.1. We need to remove that
restriction, so find the line that says

bind-address = 127.0.0.1

and comment it out. That’s all there is to it! Now get your favorite MySql client and start developing.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: