Page 1 of 2 12 LastLast
Results 1 to 10 of 20

Thread: server 12.04 can't connect to MySQL

  1. #1
    Join Date
    Sep 2011
    Location
    the Netherlands
    Beans
    60
    Distro
    Ubuntu 12.04 Precise Pangolin

    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..
    [Please come back to the ubuntuforums..] [Please mark as solved..]

  2. #2
    Join Date
    May 2007
    Location
    NY's first capital
    Beans
    2,868
    Distro
    Ubuntu 20.04 Focal Fossa

    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 -u root -p
    Code:
    mysql> use mysql;
    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).
    Nothing is ever easy, but if it is difficult you must be doing it wrong.

  3. #3
    Join Date
    Apr 2008
    Location
    LOCATION=/dev/random
    Beans
    5,767
    Distro
    Ubuntu Development Release

    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.
    Cheesemill

  4. #4
    Join Date
    Sep 2011
    Location
    the Netherlands
    Beans
    60
    Distro
    Ubuntu 12.04 Precise Pangolin

    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
    Last edited by bart.a; February 5th, 2013 at 07:25 AM.
    [Please come back to the ubuntuforums..] [Please mark as solved..]

  5. #5
    Join Date
    Sep 2011
    Location
    the Netherlands
    Beans
    60
    Distro
    Ubuntu 12.04 Precise Pangolin

    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..
    [Please come back to the ubuntuforums..] [Please mark as solved..]

  6. #6
    Join Date
    Nov 2007
    Location
    Newry, Northern Ireland
    Beans
    1,258

    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:
    1. Set a root password for mysql
    2. Remove anonymous users
    3. Limit root login to localhost only
    4. 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?
    Can't think of anything profound or witty.
    My Blog: http://gonzothegeek.blogspot.co.uk/

  7. #7
    Join Date
    Nov 2007
    Location
    Newry, Northern Ireland
    Beans
    1,258

    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
    Can't think of anything profound or witty.
    My Blog: http://gonzothegeek.blogspot.co.uk/

  8. #8
    Join Date
    Oct 2006
    Beans
    58,286

    Re: server 12.04 can't connect to MySQL

    Threads merged.

  9. #9
    Join Date
    Sep 2011
    Location
    the Netherlands
    Beans
    60
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: server 12.04 can't connect to MySQL

    Hi spynappels thanks for your reply..

    Quote Originally Posted by spynappels View Post
    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
    [Please come back to the ubuntuforums..] [Please mark as solved..]

  10. #10
    Join Date
    Nov 2007
    Location
    Newry, Northern Ireland
    Beans
    1,258

    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.
    Can't think of anything profound or witty.
    My Blog: http://gonzothegeek.blogspot.co.uk/

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •