Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm trying to make a remote mysql server on my computer. I know this isn't a wise thing to do, but I'm trying it out anyway. I'm not sure of the steps to complete here, but maybe someone can fill them in for me. First of all I have MySQL installed on my computer along with mysql admin. Then I have port 3306 port forwarded. When I login to my MySQL admin or query browser I login as localhost. Now I know there are more steps to this, since mysql is still not public. Can someone help me fill them in?


Ok guys, I can't find my my.cnf file anywhere! I've looked through MySQL Server 5.1 and all my MySQL directories but I can't find it. I don't even have an etc directory either...

share|improve this question

migrated from stackoverflow.com Oct 26 '09 at 6:49

This question came from our site for professional and enthusiast programmers.

1 Answer 1

geoff's answer is wholly inadequate for what you want to do (and not necessary if you just connect to your ip address). I'd know because I just set up my first db for remote access too! One thing that will need to be done is creating your my.cnf file (check documentation for its location based on your distribution and os). Mine looks like this:

[client]
port=3306
socket=/var/lib/mysql/mysql.sock

[mysqld]
port=3306
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1
bind-address=""MY IP ADDRESS HERE""
#bind-address=0.0.0.0

[mysql]
prompt="\U>"
prompt=(\\u@\\h) [\\d]>\\_

[mysqld_safe]
err-log=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

The important parts are the port (although I have the default port) and the bind address. The bind address listed would be your IP address. The commented out 0.0.0.0 is the wild card of IP addresses.

Before you can connect to a mysql database you must give the user you are connecting with permissions to do so. Something like the following will get your started:

GRANT ALL PRIVILEGES ON *.* for 'root'@'%' IDENTIFIED BY 'db_passwd';

*.* is the databasename.tablename wildcard. 'root' can be any user. The '%' is the host wild card, but I strongly recommend only putting your IP address ('root'@'123.123.123.123'). Your pass word (if any) will be db_passwd, and include the single quotes when you execute the line. Type FLUSH PRIVILEGES to reload these new privileges.

I'd use a network monitor program to check if you are getting connected to your mysql server. Lets see how that goes. Further help can also be found by Googling "mysql network access" etc., that is how I got it to work.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.