Page 1 of 3 123 LastLast
Results 1 to 10 of 22

Thread: MySQL not working

  1. #1
    Join Date
    Apr 2013
    Beans
    12

    MySQL not working

    Hello, I am now on this forum and I need help with my MySQL Server which is on my VPS with Ubuntu 12.10 Server.

    Everything was fine 'till today, when I tried to login to PhpMyAdmin (as root) and I got theese two errors:


    Code:
    #2002 Cannot log in to the MySQL server
    Connection for controluser as defined in your configuration failed

    So I googled for the solution, found something and commented theese lines in phpmyadmin config:

    Code:
    $cfg['Servers']['$i']['controluser'] and $cfg['Servers']['$']['controlpass']
    Now the error I was getting changed to

    Code:
    #2003 Cannot log in to the MySQL server
    
    
    So I tried to access mysql from my VNC Client, I logged in as root and typed

    Code:
    $ mysql


    and I got this error:

    Code:
    Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)


    I checked and I couldn't find that file!
    I tried creating it with touch, but didn't work..

    Then I tried to start/restart mysql service but when I type service mysql stop/start/restart I get:

    Code:
    Job failed to start!
    I also tried reinstalling mysql, php and apache2 and nothing worked!!
    Please help me, my MC servers can't work without MySQL!

    P.S.
    Today I changed ServerName in apache config because I was getting an error when I typed service apache restart:

    Code:
    Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1 for ServerName
    I'm not sure does that have anything to do with my MySQL problem.

    And there is one little thing I did in sudoers (by typing visudo):
    I wanted to execute commands from php as root so I added this line at the end of the file:

    Code:
    www-data ALL=NOPASSWD: ALL
    Unfortunately, it didn't work so I removed that line..

    Please help A.S.A.P.!

    Thank you very much,
    Leon Grdic
    Last edited by TheLG; April 4th, 2013 at 07:37 PM.

  2. #2
    Join Date
    Oct 2011
    Location
    /root
    Beans
    956
    Distro
    Ubuntu

    Re: MySQL not working

    Is it a paid VPS? In that case, you should have the option to basically nuke it and start over if even a reinstall hasn't helped...SolusVM control panel comes to mind.


  3. #3
    Join Date
    Nov 2006
    Location
    Craggy Island.
    Beans
    Hidden!
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: MySQL not working

    Hello



    try and find the sock file using

    sudo find / -name *.sock

    check your my.cnf file and ensure that matches whats in there

    my.cnf should be in /etc/mysql

    e.g

    # Remember to edit /etc/mysql/debian.cnf when changing the socket location.
    [client]
    port = 3306
    socket = /var/run/mysqld/mysqld.sock
    You can tell a man who boozes by the company he chooses, as the pig got up and slowly walked away.

  4. #4
    Join Date
    Apr 2013
    Beans
    12

    Re: MySQL not working

    Quote Originally Posted by d4m1r View Post
    Is it a paid VPS? In that case, you should have the option to basically nuke it and start over if even a reinstall hasn't helped...SolusVM control panel comes to mind.
    Yes, it's paid host, but if I reinstall I would loose all databases!

  5. #5
    Join Date
    Jan 2005
    Location
    South Africa
    Beans
    2,098
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: MySQL not working

    Quote Originally Posted by TheLG View Post
    Code:
    Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
    indicates that the server is not started. So you will not be able to connect anyway. Check the mysql error logs to find pointers as to why the service does not start.
    Last edited by Wim Sturkenboom; April 2nd, 2013 at 08:59 AM.
    If you don't make backups of your important data, your data is obviously not important to you.

  6. #6
    Join Date
    Apr 2013
    Beans
    12

    Re: MySQL not working

    Quote Originally Posted by jonobr View Post
    Hello



    try and find the sock file using

    sudo find / -name *.sock

    check your my.cnf file and ensure that matches whats in there

    my.cnf should be in /etc/mysql

    e.g

    # Remember to edit /etc/mysql/debian.cnf when changing the socket location.
    [client]
    port = 3306
    socket = /var/run/mysqld/mysqld.sock
    Thank you very much for your reply!
    After typing sudo find / -name *.sock i got only /run/proftpd.sock!
    Nothing else was found..

  7. #7
    Join Date
    Apr 2013
    Beans
    12

    Re: MySQL not working

    Quote Originally Posted by Wim Sturkenboom View Post
    indicates that the server is not started. So you will not be able to connect anyway. Check the mysql error logs to find pointers as to why the service does not start.

    But where can I find logs?
    And I think that there is no reason for checking logs because mysql socket is missing!

  8. #8
    Join Date
    Jan 2005
    Location
    South Africa
    Beans
    2,098
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: MySQL not working

    No, the socket file is created by the mysql daemon when the mysql deamon is started. If it fails to start (or when you stop the service), the socket file is removed again.

    The log can be found in the directory /var/log/mysql (if you have a standard setup)
    Last edited by Wim Sturkenboom; April 2nd, 2013 at 10:51 AM. Reason: Attempt to make it a little clearer
    If you don't make backups of your important data, your data is obviously not important to you.

  9. #9
    Join Date
    Apr 2013
    Beans
    12

    Re: MySQL not working

    Quote Originally Posted by Wim Sturkenboom View Post
    No, the socket file is created by the mysql daemon when the mysql deamon is started. If it fails to start (or when you stop the service), the socket file is removed again.

    The log can be found in the directory /var/log/mysql (if you have a standard setup)
    Thank you for your reply, I opened error.log located in that folder but it's empty.. There are also some files named error.log.1.gz but when I open it with nano it's empty...
    Also, mysql on my server does not create a socket..

    Thank you..

  10. #10
    Join Date
    Jul 2009
    Beans
    516
    Distro
    Ubuntu 16.04 Xenial Xerus

    Re: MySQL not working

    Type the following to see if it's actually running
    Code:
    ps -p $(pgrep -x mysqld) -f
    You can check the status of the daemon with
    Code:
    sudo service mysql status
    If it's appears to not be running then try starting it manually with
    Code:
    sudo service mysql start
    it should provide output indicating if it started OK or not.

    You can run the first two commands again to confirm it's running and also
    Code:
    ls -l /var/run/mysqld/mysqld.sock
    to check that it's created the UNIX domain socket.
    Mark your thread as [SOLVED], use Thread Tools on forum page.

Page 1 of 3 123 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
  •