Find the answer to your Linux question:
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 11
I get this error whenever I try to connect to mysql. This error also appears when I type <code>mysql -p root</code> root@slackware:/var/run/mysql# mysql ERROR 2002: Can't connect to local MySQL ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Mar 2005
    Posts
    45

    mysql cannot connect error.


    I get this error whenever I try to connect to mysql. This error also appears when I type

    <code>mysql -p root</code>

    root@slackware:/var/run/mysql# mysql
    ERROR 2002: Can't connect to local MySQL server through socket '/var/run/mysql/mysql.sock' (2)

  2. #2
    Linux Guru sdousley's Avatar
    Join Date
    Feb 2004
    Posts
    1,790
    try connecting with:
    Code:
    mysql -u root -p
    -u tells mysql server what username to use, and the -p (wqith nothing after it) tells the server to prompt for a password
    "I am not an alcoholic, alcoholics go to meetings"
    Registered Linux user = #372327

  3. #3
    Just Joined!
    Join Date
    Apr 2005
    Posts
    40
    Have you installed initial database?

    Code:
    su - mysql
    mysql_install_db

  4. $spacer_open
    $spacer_close
  5. #4
    Just Joined!
    Join Date
    Mar 2005
    Posts
    45
    I tried installing the initial database, but I still get the same error when I do
    Code:
    mysql -u root -p
    I also set a root mysql password already. Whenever I turn on the computer, it also says that mysql has shut down. I will post the exact error when I can

  6. #5
    Linux Guru sdousley's Avatar
    Join Date
    Feb 2004
    Posts
    1,790
    Quote Originally Posted by mr.popper
    Whenever I turn on the computer, it also says that mysql has shut down. I will post the exact error when I can
    This could be a problem, if the mysql server isn'#t up and running, u cant connect to it. try:
    Code:
    /etc/init.d/mysql start
    to start the mysql server, then try the
    Code:
    mysql -u root -p
    command
    "I am not an alcoholic, alcoholics go to meetings"
    Registered Linux user = #372327

  7. #6
    Just Joined!
    Join Date
    Dec 2004
    Location
    Dallas
    Posts
    10
    I have a feeeling you could be getting the error that is caused by bad permissions in the mysql directory. Try this command out:

    Code:
    chown -R mysql&#58;mysql /var/lib/mysql

  8. #7
    Just Joined!
    Join Date
    Mar 2005
    Posts
    45
    apparently there is no such directory as

    /etc/init.d/mysql

    I found it in /usr/bin/mysql

    if I do /usr/bin/mysql start, I get the same error as always. I also tried chown-ing that folder, but with the same result.

  9. #8
    Linux Newbie
    Join Date
    Jan 2004
    Location
    Belgrade, S&M
    Posts
    177
    Try this:
    Code:
    &#40;as root&#41;
    chown +x /etc/rc.d/rc.mysqld
    /etc/rc.d/rc.mysqld start
    myswl_install_db
    mysql -u root -p
    Does it work ?

  10. #9
    Just Joined!
    Join Date
    Mar 2005
    Posts
    45
    that worked, thanks! How do I get mysqld to start on boot?

  11. #10
    Just Joined!
    Join Date
    Apr 2005
    Posts
    40
    Code:
    chmod 755 /etc/rc.d/rc.mysqld

Page 1 of 2 1 2 LastLast

Posting Permissions

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