Ubuntu Mysql Problem

Discussion in 'Installation/Configuration' started by DualFusion, May 31, 2009.

  1. DualFusion

    DualFusion New Member

    Hi,

    I installed mysql on my ubuntu jaunty server using:

    Code:
    sudo apt-get install mysql-server mysql-client libmysqlclient15-dev
    i also installed some other stuff later on. When I was done configuring my server, I tried to connect, but was unable to. I started getting errors about how 'root'@'localhost' (or anyone for that matter) was able to log in.

    I reinstalled and the same thing happened again. I searched online for several solutions and they suggested that I remove /etc/mysql then do:

    Code:
    sudo apt-get --purge remove mysql-server mysql-client libmysqlclient15-dev
    and then install again. I tried starting the service, but it failed saying that it couldn't load /etc/mysql/my.cnf. I did a directory listing of /etc/mysql and only found 2 files in it. debian.cnf and debian-start. Now I am so confused.

    If possible, can you tell me how to properly fix this and get mysql working on my ubuntu jaunty server?

    Thanks, Kevin.
     
  2. falko

    falko Super Moderator Howtoforge Staff

    Did you accidentally delete any files in /etc/mysql/? Did you see any errors during the MySQL installation? Is there enough free disk space?
     
  3. mitochon

    mitochon New Member

    I had what looks like the same issue as you, under Ubuntu Jaunty (9.04).

    I finally ended up copying over the /etc/mysql directory from a different server.
    Here's what the (working) contents looked like after the copy:

    # ls -l /etc/mysql
    total 16
    drwxr-xr-x 2 root root 4096 2009-06-12 17:23 conf.d
    -rw------- 1 root root 312 2009-06-12 17:23 debian.cnf
    -rwxr-xr-x 1 root root 1198 2009-05-14 05:39 debian-start
    -rw-r--r-- 1 root root 4088 2009-03-30 15:18 my.cnf

    /etc/mysql# ls -l conf.d/
    total 0

    So, the copy provided the conf.d directory and the my.cnf file that the re-install failed to (re)create.
    Here's the active info from my.cnf (after being filtered through " egrep -v '^$|^#' my.cnf " to remove empty lines and comment lines) :
    -----my.cnf start------
    [client]
    port = 3306
    socket = /var/run/mysqld/mysqld.sock
    [mysqld_safe]
    socket = /var/run/mysqld/mysqld.sock
    nice = 0
    [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
    skip-external-locking
    bind-address = 127.0.0.1
    key_buffer = 16M
    max_allowed_packet = 16M
    thread_stack = 128K
    thread_cache_size = 8
    myisam-recover = BACKUP
    query_cache_limit = 1M
    query_cache_size = 16M
    expire_logs_days = 10
    max_binlog_size = 100M
    skip-federated
    [mysqldump]
    quick
    quote-names
    max_allowed_packet = 16M
    [mysql]
    [isamchk]
    key_buffer = 16M
    !includedir /etc/mysql/conf.d/

    -----my.cnf end------
    Recreating that file may help you get mysql back running, as it appears to have been essential for me.

    I'm going to put up a copy of the complete, default /etc/mysql/my.cnf on a page documenting this fix, just in case I or someone else needs it or finds it convenient. (The comments in the default my.cnf are very useful.)
    That will be at http://handsomeplanet.com.
    I can post an exact link when I'm done if anyone is interested. Thanks.
     

Share This Page