MySQL – Remote Access to MySQL Server on Linux CentOS 6.3 Part 2

5
23



In this tutorial I talk you through installing and configuring a MySQL server to allow remote access on Linux using CentOS 6.3.

So first, download and install the mysql server: yum install mysql mysql-server

Next make it so as the mysql server with be running on server startup, issue the following command:

chkconfig mysqld on

Next start the mysqld service

service mysqld start

Next run the command /usr/bin/mysql_secure_installation in order to set the root password and to delete other users and ultimately to stop the root user from having remote access.

Then you can access the mysql server, to make a new user, which you can login in as rather than using the root user all of the time.

We then editted the /etc/my.cnf, to allow the server to be access remotely only on the address of 10.10.10.30, which was the static ip address of this machine which we install the mysql server on.

We add the following line to this file below the area which is [mysqld]
bind-address=10.10.10.30

Note: this ip address needs to be static ip address of this single machine.

Next we added a rule to the firewall by editting the /etc/sysconfig/iptables file, by adding the following line to it, above the ssh line:

-A INPUT -p tcp -m state –state NEW,ESTABLISHED -m tcp –dport 3306 -j ACCEPT

Once you have save and closed this file, restart or reload the iptables:

service iptables restart

Potentially, this is the server ready to be used remotely, although you are still required to add a user which has the correct privileges:

No more space available…best just watch the video!!!!

Nguồn:https://danhnhan.vn/


https://danhnhan.vn/giai-tri

5 COMMENTS

  1. i love that you left the mistake in the video. A lot of other people would of just redo the video or edit it out, but then the audience would not know what to do when they get that same error/mistake. thank you. +1

  2. There are tons of entries out here for connecting to a MySQL server remotely and you are the only one that addressed the changes needed in the config files that allowed the connection to actually work.  Do you have anything for remote connections to MySQL using SSH and port forwarding which I think is a more secure practice for remote accessing a MySQL server.  Do you have?  Contact me for consulting.

  3. I can connect using the default port 3306 remotely …
    but cant when the port number is change to something like 5123 …

    what can be the issue ?

LEAVE A REPLY

Please enter your comment!
Please enter your name here