LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (http://www.linuxquestions.org/questions/linux-software-2/)
-   -   MySQL over TCP? (http://www.linuxquestions.org/questions/linux-software-2/mysql-over-tcp-341352/)

Waerner 07-08-2005 02:21 PM

MySQL over TCP?
 
Hello, I've tried to reach my MySQL-server for a long time now - using remote tools like Query Browser and Administrator, but I can't get the TCP-connections to work, I've looked around in the whole filesystem for config files, and the one I've found is my.cnf.

Does anyone know how I can get this thing work? :confused:

fouldsy 07-08-2005 02:29 PM

What is it that you are trying to do exactly? Manage your MySQL databases using a web front-end? If so, I've always used http://www.phpmyadmin.net and has worked fine for me. If not, then what was it you're trying to do?

twsnnva 07-08-2005 03:55 PM

Waerner,
There is an option in my.cnf called skip-networking. Make sure you comment this out and restart mysql or remote hosts will not be able to connect to the mysql server. I've seen this be the culprit several times, so I just thought I'd mention it.

Waerner 07-13-2005 12:01 PM

twsnnva,

I'm trying to connect to the MySQL-server (192.168.0.10) from my computer (192.168.0.1) - using MySQL Query Browser.

I did what you told me to, I added an # in the front of the "Skip-networking" in /etc/mysql/my.cnf, and rebooted the whole computer.
And when I try to connect now (from 192.168.0.1) I get the reply:

Could not connect to the specified instance.

MySQL Error Number 1130
Host '192.168.0.1' is not allowed to connect to this MySQL server.


Do I need to grant access for using network connections to the used account (Root)?

twsnnva 07-13-2005 06:46 PM

Yeah, most distros disable root access from everywhere but localhost. Mysql stores all of the user info in a database called mysql. It's simple to change.

On the server running mysql, enter the mysql command line, and verify that root is only allowed to login from localhost.

Code:

thunder:~# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 801 to server version: 4.0.24_Debian-10-log

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> SELECT Host FROM user WHERE User = 'root';
+-----------+
| Host      |
+-----------+
| localhost |
+-----------+
1 row in set (0.00 sec)

Removing localhost will allow root to login from anywhere.
Code:

mysql> UPDATE user SET Host='' where User='root';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0

Now verify that localhost is gone, and quit.
Code:

mysql> SELECT Host FROM user WHERE User = 'root';
+------+
| Host |
+------+
|      |
+------+
1 row in set (0.00 sec)

mysql> exit
Bye
thunder:~#

You may need to restart mysql, but that should do the trick.

sundialsvcs 07-13-2005 07:40 PM

You will probably find a log-file in /var/log or somesuch that will tell you more. There are a few general scenarios to sort between:
  • The message isn't getting out... a firewall's blocking it.
  • The SQL server has been told to ignore you; perhaps it's not supposed to listen to anyone "outside."
  • The SQL server doesn't recognize your login from that machine.
The latter two points are the purview of my.cnf adjustments. The logs should tell all. A ping to the IP-address and port that you think you can connect to will quickly tell you if you can, in fact, "get there at all."

Waerner 07-13-2005 08:05 PM

It all went easy and smooth by doing exactly what twsnnva wrote :)

Thanks alot mate(s) :D


All times are GMT -5. The time now is 01:59 PM.