Page 1 of 5 123 ... LastLast
Results 1 to 10 of 50

Thread: MySQL ERROR 2002 (HY000): Can't connect to local...

  1. #1
    Join Date
    Feb 2008
    Location
    Swansea
    Beans
    144
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    MySQL ERROR 2002 (HY000): Can't connect to local...

    I upgraded to 8.04 recently and during the upgrade process Ubuntu asked me if I wanted to change one of my mysql configuration files and I must have clicked yes which is why I am in a bit of a pickle now. I currently get the following when I try to log in:

    Code:
    arthur@localhost:/etc/mysql$ mysql -u root -p
    Enter password: 
    ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
    And my /etc/mysql/my.cnf is as follows:

    Code:
    #
    # The MySQL database server configuration file.
    #
    # You can copy this to one of:
    # - "/etc/mysql/my.cnf" to set global options,
    # - "~/.my.cnf" to set user-specific options.
    # 
    # One can use all long options that the program supports.
    # Run program with --help to get a list of available options and with
    # --print-defaults to see which it would actually understand and use.
    #
    # For explanations see
    # http://dev.mysql.com/doc/mysql/en/server-system-variables.html
    
    # This will be passed to all mysql clients
    # It has been reported that passwords should be enclosed with ticks/quotes
    # escpecially if they contain "#" chars...
    # Remember to edit /etc/mysql/debian.cnf when changing the socket location.
    [client]
    port		= 3306
    socket		= /var/run/mysqld/mysqld.sock
    
    # Here is entries for some specific programs
    # The following values assume you have at least 32M ram
    
    # This was formally known as [safe_mysqld]. Both versions are currently parsed.
    [mysqld_safe]
    socket		= /var/run/mysqld/mysqld.sock
    nice		= 0
    
    [mysqld]
    #
    # * Basic Settings
    #
    
    #
    # * IMPORTANT
    #   If you make changes to these settings and your system uses apparmor, you may
    #   also need to also adjust /etc/apparmor.d/usr.sbin.mysqld.
    #
    
    user		= mysql
    pid-file	= /var/run/mysqld/mysqld.pid
    socket		= /var/run/mysqld/mysqld.sock
    port		= 3306
    basedir		= /usr
    datadir		= /var/lib/mysql
    tmpdir		= /tmp
    language	= /usr/share/mysql/english
    skip-external-locking
    #
    # Instead of skip-networking the default is now to listen only on
    # localhost which is more compatible and is not less secure.
    bind-address		= 127.0.0.1
    #
    # * Fine Tuning
    #
    key_buffer		= 16M
    max_allowed_packet	= 16M
    thread_stack		= 128K
    thread_cache_size	= 8
    #max_connections        = 100
    #table_cache            = 64
    #thread_concurrency     = 10
    #
    # * Query Cache Configuration
    #
    query_cache_limit       = 1M
    query_cache_size        = 16M
    #
    # * Logging and Replication
    #
    # Both location gets rotated by the cronjob.
    # Be aware that this log type is a performance killer.
    #log		= /var/log/mysql/mysql.log
    #
    # Error logging goes to syslog. This is a Debian improvement :)
    #
    # Here you can see queries with especially long duration
    #log_slow_queries	= /var/log/mysql/mysql-slow.log
    #long_query_time = 2
    #log-queries-not-using-indexes
    #
    # The following can be used as easy to replay backup logs or for replication.
    # note: if you are setting up a replication slave, see README.Debian about
    #       other settings you may need to change.
    #server-id		= 1
    #log_bin			= /var/log/mysql/mysql-bin.log
    expire_logs_days	= 10
    max_binlog_size         = 100M
    #binlog_do_db		= include_database_name
    #binlog_ignore_db	= include_database_name
    #
    # * BerkeleyDB
    #
    # Using BerkeleyDB is now discouraged as its support will cease in 5.1.12.
    skip-bdb
    #
    # * InnoDB
    #
    # InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
    # Read the manual for more InnoDB related options. There are many!
    # You might want to disable InnoDB to shrink the mysqld process by circa 100MB.
    #skip-innodb
    #
    # * Security Features
    #
    # Read the manual, too, if you want chroot!
    # chroot = /var/lib/mysql/
    #
    # For generating SSL certificates I recommend the OpenSSL GUI "tinyca".
    #
    # ssl-ca=/etc/mysql/cacert.pem
    # ssl-cert=/etc/mysql/server-cert.pem
    # ssl-key=/etc/mysql/server-key.pem
    
    
    
    [mysqldump]
    quick
    quote-names
    max_allowed_packet	= 16M
    
    [mysql]
    #no-auto-rehash	# faster start of mysql but no tab completition
    
    [isamchk]
    key_buffer		= 16M
    
    #
    # * NDB Cluster
    #
    # See /usr/share/doc/mysql-server-*/README.Debian for more information.
    #
    # The following configuration is read by the NDB Data Nodes (ndbd processes)
    # not from the NDB Management Nodes (ndb_mgmd processes).
    #
    # [MYSQL_CLUSTER]
    # ndb-connectstring=127.0.0.1
    
    
    #
    # * IMPORTANT: Additional settings that can override those from this file!
    # The files must end with '.cnf', otherwise they'll be ignored.
    #
    !includedir /etc/mysql/conf.d/
    I see that the above has the following line:

    Code:
    socket		= /var/run/mysqld/mysqld.sock
    I looked in the directory and its empty.

    If I could find where the error file is I would post it here, but I don't have a clue where it would be inside the os

    I found addition help at the mysql forums (something to do with linking ?!?! Never done linking before so I'm a bit lost)

    http://forums.mysql.com/read.php?11,...4974#msg-14974

    I tryed as a last resort this but it didn't work:

    http://forums.mysql.com/read.php?11,...127#msg-131127

    this might be of interest:

    Code:
    arthur@localhost:/$ ls -l /var/run/ | grep mysqld
    drwxr-xr-x 2 mysql      root         40 2008-05-22 23:08 mysqld
    and this:

    Code:
    arthur@localhost:/etc$ ls -l | grep mysql
    drwxr-xr-x  3 www-data www-data   4096 2008-05-20 01:55 mysql
    I'm not to sure if the owernership of thoses folders should be 'www-data' or 'mysql'

    I did this as well:

    http://forums.mysql.com/read.php?11,...6554#msg-16554

    No joy

    Then I did this

    Code:
    arthur@localhost:/var/lib/mysql$ sudo su
    root@localhost:/var/lib/mysql# mysqld
    InnoDB: The log sequence number in ibdata files does not match
    InnoDB: the log sequence number in the ib_logfiles!
    080523  0:32:57  InnoDB: Database was not shut down normally!
    InnoDB: Starting crash recovery.
    InnoDB: Reading tablespace information from the .ibd files...
    InnoDB: Restoring possible half-written data pages from the doublewrite
    InnoDB: buffer...
    InnoDB: Last MySQL binlog file position 0 3388, file name /var/log/mysql/mysql-bin.000031
    080523  0:32:57  InnoDB: Started; log sequence number 0 63353
    080523  0:32:57 [ERROR] Fatal error: Can't open and lock privilege tables: Incorrect file format 'user'
    And thought WOW! what do I do now?

    An help would be gratefully appreciated
    There is nothing common about sense - unknown

  2. #2
    Join Date
    Feb 2008
    Location
    Swansea
    Beans
    144
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Re: MySQL ERROR 2002 (HY000): Can't connect to local...

    Anybody?
    There is nothing common about sense - unknown

  3. #3
    Join Date
    Sep 2007
    Beans
    Hidden!

    Re: MySQL ERROR 2002 (HY000): Can't connect to local...

    try
    Code:
    sudo mysqladmin password newpassword
    type a new pass..
    and then
    Code:
    sudo mysql -u root -p
    good luck

  4. #4
    Join Date
    Feb 2008
    Location
    Swansea
    Beans
    144
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Re: MySQL ERROR 2002 (HY000): Can't connect to local...

    I got the following:

    Code:
    root@localhost:/home/arthur# mysqladmin password newpassword
    mysqladmin: connect to server at 'localhost' failed
    error: 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)'
    Check that mysqld is running and that the socket: '/var/run/mysqld/mysqld.sock' exists!
    root@localhost:/home/arthur#
    There is nothing common about sense - unknown

  5. #5
    Join Date
    Jun 2007
    Location
    Maryland, US
    Beans
    6,245
    Distro
    Kubuntu

    Re: MySQL ERROR 2002 (HY000): Can't connect to local...

    This may seem silly, but have you verified that the MySQL server is running?

    Verify using 'ps -ef | grep mysql'. You should see something like:
    Code:
    $ ps -ef |grep mysql
    root      5325     1  0 13:09 ?        00:00:00 /bin/sh /usr/bin/mysqld_safe
    mysql     5413  5325  0 13:09 ?        00:00:00 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --pid-file=/var/run/mysqld/mysqld.pid --skip-external-locking --port=3306 --socket=/var/run/mysqld/mysqld.sock
    root      5415  5325  0 13:09 ?        00:00:00 logger -p daemon.err -t mysqld_safe -i -t mysqld

  6. #6
    Join Date
    Feb 2008
    Location
    Swansea
    Beans
    144
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Re: MySQL ERROR 2002 (HY000): Can't connect to local...

    Not to sure what I'm looking for, but this is what I get:

    Code:
    arthur@localhost:~$ ps -ef | grep mysql
    arthur    6946  6928  0 22:39 pts/0    00:00:00 grep mysql
    arthur@localhost:~$
    There is nothing common about sense - unknown

  7. #7
    Join Date
    Jun 2007
    Location
    Maryland, US
    Beans
    6,245
    Distro
    Kubuntu

    Re: MySQL ERROR 2002 (HY000): Can't connect to local...

    Your mysql server is not running!

    I don't have my Ubuntu system available at this moment, but I believe if you navigate into the System->Administration pull-down, there is a menu option to control "services" or something to that effect.

    From there, you can start the mysql server. Then you should be able to connect (that is, log on).

  8. #8
    Join Date
    Feb 2008
    Location
    Swansea
    Beans
    144
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Re: MySQL ERROR 2002 (HY000): Can't connect to local...

    Right, I know what you are getting at. I have got a screen shot of it. You will see that it is 'off' in the screen shot.

    When I loaded up services and it was enabled,

    I disabled it in the hope of re-enabling it (like in the services window, under admin tools in xp) and now I can re-enable it
    Attached Images Attached Images
    There is nothing common about sense - unknown

  9. #9
    Join Date
    Feb 2008
    Location
    Swansea
    Beans
    144
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Re: MySQL ERROR 2002 (HY000): Can't connect to local...

    In addition I found the following in regards to starting mysql service from the command line. I tried the following:

    Code:
    sudo apt-get install mysql-server
    Thinking that I might not have the server installed (I've done worse), and got the following in reply:

    Code:
    arthur@localhost:~$ sudo apt-get install mysql-server
    [sudo] password for arthur: 
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    mysql-server is already the newest version.
    The following packages were automatically installed and are no longer required:
      pwgen libglib1.2ldbl liblzo1 libgtk1.2 libqt3-mt-mysql libfame-0.9 libpvm3
      libfftw3-3 libmyth-0.21-0 transcode ntp libtunepimp5 libifp4
      libgtk1.2-common libmyth-perl xaw3dg libnet-upnp-perl libnjb5 libofa0
    Use 'apt-get autoremove' to remove them.
    0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
    2 not fully installed or removed.
    After this operation, 0B of additional disk space will be used.
    Setting up mysql-server-5.0 (5.0.51a-3ubuntu5.1) ...
     * Stopping MySQL database server mysqld                                 [ OK ] 
    Reloading AppArmor profiles Warning: found /etc/apparmor.d/force-complain/usr.sbin.mysqld, forcing complain mode
    : done.
     * Starting MySQL database server mysqld                                 [fail] 
    invoke-rc.d: initscript mysql, action "start" failed.
    dpkg: error processing mysql-server-5.0 (--configure):
     subprocess post-installation script returned error exit status 1
    dpkg: dependency problems prevent configuration of mysql-server:
     mysql-server depends on mysql-server-5.0; however:
      Package mysql-server-5.0 is not configured yet.
    dpkg: error processing mysql-server (--configure):
     dependency problems - leaving unconfigured
    Errors were encountered while processing:
     mysql-server-5.0
     mysql-server
    E: Sub-process /usr/bin/dpkg returned an error code (1)
    arthur@localhost:~$
    AND every time I install new software I get the following:
    Attached Images Attached Images
    There is nothing common about sense - unknown

  10. #10
    Join Date
    Feb 2008
    Location
    Swansea
    Beans
    144
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Re: MySQL ERROR 2002 (HY000): Can't connect to local...

    On another note

    Code:
    sudo gedit /var/log/mysql.log
    and

    Code:
    sudo gedit /var/log/mysql.err
    both return empty files. Maybe I could try to start mysql from the command and and use a flag to get it to write to the log files.
    There is nothing common about sense - unknown

Page 1 of 5 123 ... LastLast

Tags for this Thread

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
  •