• CentOS MySQL
    3 replies, posted
I recently installed mysql on a centos vps, does anyone know how I can access it remotly? When I try connecting via HeidiSQL it says I am not allowed to connect, however the username and password have all privileges granted( I would know, I ran GRANT ALL PRIVILEGES on it again ). So basically what I'm asking is how can I make the database allow incoming connections? I allowed incoming connections on port 3306 in the iptables, so thats not the problem
You'll need to allow networking for MySQL to be able to connect to it remotely. You can do this by connecting to your server via SSH (or sFTP) as root. Now, open the following file in your prefered text editor (for example, nano). cd ../etc nano -w my.cnf In the my.cnf you should see a section entitled "[mysqld]", in that section look for a line saying "skip-networking", comment that out with # so it looks like "# skip-networking" (alternatively you could just delete the line all together but that's up to you). What this line does is basically manage wether MySQL will listen to incoming external connections or wether it shall only listen to internal connections. Save the file, and then restart mysql with the following command; service mysqld restart Should work if you've done everything else needed.
great, I will be testing here in about an hour! thank you.
[QUOTE=Gishank;30716859]You can do this by connecting to your server via SSH (or sFTP) as root.[/QUOTE] Logging in as root directly is generally discouraged; you should log in as a normal user account and then use su or sudo. For security, set PermitRootLogin to "no" in /etc/ssh/sshd_config as a defense against the SSH brute-force attacks that botnets often do. [QUOTE=Gishank;30716859] cd ../etc nano -w my.cnf [/QUOTE] That's unnecessarily brittle: the relative path in the "cd" command assumes that you start out in a directory like /root that's a direct sibling of /etc, and will fail if you start in /home/[i]username[/i] instead. Why not just "cd /etc"? Or skip changing directory entirely, and just "nano -w /etc/my.cnf"?
Sorry, you need to Log In to post a reply to this thread.