server 12.04 can't connect to MySQL
Hi..
Before my main board started smoking my (very simple) file server (Ubuntu 12.04 also) with MySQL support was running just fine.. I used it as a file server for a couple of workstations and had MySQL server running for a few simple databases.. I used to connect to the databases with LibreOffice Base via the java connector and that all worked fine.. BUT..
Now I re installed all of the above on my new hardware and everything works. I can see, manage and do everything with the databases via phpmyadmin (from a workstation).
But I cannot get the connection between LibreOffice and MySQL and I can't find what I'm doing wrong..
It gives me the same error over and over: SQL-status: 08S01 Communications link failure.
I tried disabling the firewall on both machines, no success.
The cause could be that I installed "mysql_secure_installation" after my install but I don't know how to undo it.. Re-installing did not even remove my databases so that's an issue..
Can anyone please help me? I'm lost.. Thanks..
Re: server 12.04 can't connect to MySQL
Your user needs to have access from the LAN.
Check your user database to see where the user in question is allowed to connect from. You may need to modify the host field for the user or add the user again with the specific host.
Code:
mysql> select host, user from user;
If you only have localhost configured this could be the problem. This is assuming you are trying to connect to mysql from a remote machine (LibreOffice is not running on the server).
Re: server 12.04 can't connect to MySQL
Also by default MySQL doesn't allow external connections.
To enable connections from other machines you need to edit /etc/mysql/my.conf and comment out the bind-address line so it looks like...
Code:
#bind-address = 127.0.0.1
Restart mysql and you should be good to go.
Re: server 12.04 can't connect to MySQL
Thanks for your reply Volkswagner and Cheesemill..
my /etc/mysql/my.cnf file did not have the bind-address commented out.. but I believe it was in my first 100 tries.. I changed it now. I'll test it tomorrow morning..
edit: I tested it, no success, still the same error.. It just doesn't seem to connect..
I looked at my mysql users all users have access to the databases from there own (static) IP-address and from the range all address are in, so that shouldn't be the problem..
Output:
Code:
mysql> SELECT host, user FROM user;
+--------------+------------------+
| host | user |
+--------------+------------------+
| 127.0.0.1 | root |
| 192.168.1.% | usr1 |
| 192.168.1.% | usr2 |
| 192.168.1.% | usr3 |
| 192.168.1.71 | usr2 |
| 192.168.1.72 | usr1 |
| ::1 | root |
| fileServer | |
| fileServer | root |
| localhost | |
| localhost | usr1 |
| localhost | debian-sys-maint |
| localhost | phpmyadmin |
| localhost | root |
| localhost | usr3 |
+--------------+------------------+
I also exported the CLASSPATH by putting it in my .bashrc file
Code:
CLASSPATH=$CLASSPATH:/usr/share/java/mysql-connector-java.jar
export CLASSPATH
server 12.04 undo mysql_secure_installation
Hi..
I think I have problems with my MySQL connections because I installed "mysql_secure_installation" after my install.. Re-installing did not even remove my databases so that's an issue..
I would like to undo the "mysql_secure_installation" so I can test if my connections can be made.. But I don't know how to do that..
Can anyone please help me? I'm lost.. Thanks..
Re: server 12.04 can't connect to MySQL
Hi Bart,
I don't think that the mysql_secure_installation has anything to do with this, it is just a script which carries out 4 different functions:
- Set a root password for mysql
- Remove anonymous users
- Limit root login to localhost only
- Remove the test database
So to answer your question in another thread, you don't "uninstall" it as such, although you can undo each of the above actions individually. However, I'm really not convinced that these are the casue of your problems.
Have you checked your firewall rules?
Re: server 12.04 undo mysql_secure_installation
Hi Bart,
I answered this question in your other thread, but to summarise, the mysql_secure_installation script is not installed, it carries out 4 specific functions which can be undone individually if required. However, I don't think this is causing your issues.
I'll try and help out in the other thread.
Regards,
Stefan
Re: server 12.04 can't connect to MySQL
Re: server 12.04 can't connect to MySQL
Hi spynappels thanks for your reply..
Quote:
Originally Posted by
spynappels
Have you checked your firewall rules?
ufw allows all relevant ip-addresses for apache and port 3306..
Just to be sure I tried it again.. I disabled ufw, stopped windows firewall completely and stopped virus scanner..
But still the same error..
Have you got another suggestion? I really don't know what to do next
Re: server 12.04 can't connect to MySQL
Ok, let's go back to the beginning. After you re-installed, you did not run the mysql_secure_install script again, because there are still anonymous users. Are these anonymous connections required? If not, I'd get rid of them. Have you also set a password for root and all other users?
Are user1 etc running on Ubuntu as well? If they are, I'd check if you can access the MySQL DB from a cli mysql client on that user's machine. This will check whether access to the db works from other hosts for specific users.
From user1's machine, do the following:
Code:
mysql -u user1 -h 192.168.1.xx -p
where the IP address is that of the server.
If this works correctly, the issue is more likely to be with the Java connector.