Link to home
Create AccountLog in
MySQL Server

MySQL Server

--

Questions

--

Followers

Top Experts

Avatar of angelous
angelous

ERROR 2002: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
Hi

I have recently installed MySQL 4.0 on my Debian Linux box and get the following error when i run:

root@xbox:/# /usr/local/mysql/bin/mysql start
ERROR 2002: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

I have looked in /tmp/ and there is no mysql.sock file. But i dont know how to create one or what to put in it etc etc.


Rik.

Zero AI Policy

We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.


Avatar of paullamhkgpaullamhkg

Login as root,

     shell> cd /path-to/mysql
     shell> scripts/mysql_install_db

this will build the grant table for your mysql to run, try if you still got problem, post it here

oh for the /tmp/mysql.sock you no need to create. and the error show that you havn't create the grant table after install the mysql, try it :)

Avatar of angelousangelous

ASKER

Hi

I run the command; scripts/mysql_install_db and it output:

root@xbox:/usr/local/mysql# scripts/mysql_install_db
Installing all prepared tables
031218  9:42:37  ./bin/mysqld: Shutdown Complete


To start mysqld at boot time you have to copy support-files/mysql.server
to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
This is done with:
./bin/mysqladmin -u root password 'new-password'
./bin/mysqladmin -u root -h xbox.oh.rik password 'new-password'
See the manual for more instructions.

NOTE:  If you are upgrading from a MySQL <= 3.22.10 you should run
the ./bin/mysql_fix_privilege_tables. Otherwise you will not be
able to use the new GRANT command!

You can start the MySQL daemon with:
cd . ; ./bin/mysqld_safe &

You can test the MySQL daemon with the benchmarks in the 'sql-bench' directory:
cd sql-bench ; perl run-all-tests

Please report any problems with the ./bin/mysqlbug script!

The latest information about MySQL is available on the web at
http://www.mysql.com
Support MySQL by buying support/licenses at https://order.mysql.com

root@xbox:/usr/local/mysql#

Then i run the command to start it and got the following:

root@xbox:/usr/local/mysql# Starting mysqld daemon with databases from /usr/local/mysql/data
031218 09:44:25  mysqld ended


Any suggestions?

Reward 1Reward 2Reward 3Reward 4Reward 5Reward 6

EARN REWARDS FOR ASKING, ANSWERING, AND MORE.

Earn free swag for participating on the platform.


Can you tell me how you  install mysql? are you using source/binary code?

For source/binary code installation have you set up the user account 'mysql' and have you give the correct user access right? below is the standard installation from mysql-standard-4.0.16-pc-linux-i686.

     shell> groupadd mysql
     shell> useradd -g mysql mysql
     shell> cd /usr/local
     shell> gunzip < /path/to/mysql-VERSION-OS.tar.gz | tar xvf -
     shell> ln -s full-path-to-mysql-VERSION-OS mysql
     shell> cd mysql
     shell> scripts/mysql_install_db
     shell> chown -R root  .
     shell> chown -R mysql data
     shell> chgrp -R mysql .
     shell> bin/mysqld_safe --user=mysql &

is this how you install your mysql? if no, try this.

Hi

I think i am getting closer. When i run bin/mysqld_safe --user=mysql &   it just pauses. Does seem to do anything. So i run /usr/local/mysql# bin/mysqld start   and the following happened.


root@xbox:/usr/local/mysql# bin/mysqld start
031219 21:58:41  Can't start server: Bind on TCP/IP port: Address already in use
031219 21:58:41  Do you already have another mysqld server running on port: 3306 ?
031219 21:58:41  Aborting

031219 21:58:41  bin/mysqld: Shutdown Complete

ASKER CERTIFIED SOLUTION
Avatar of paullamhkgpaullamhkg

Link to home
membership
Log in or create a free account to see answer.
Signing up is free and takes 30 seconds. No credit card required.
Create Account

Thanks very much, all is working now. Your a savior!



Rik.

Free T-shirt

Get a FREE t-shirt when you ask your first question.

We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.



Hi i am getting ERROR 2002: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
when I tried to login to mysql using

mysql -u root -p
password: mysql
ERROR 2002: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

I have installled mysql on Red Hat Lunx 9
It worked for one day. After that it is not working. I have changed root password.
I found that mysql deamon is not running. When i tried to start the mysql deamon using

bin/mysqld_safe --user=mysql &

it displayed

[1] 3707

I have tried to execute
./sql-bench/run-all-tests

I got following error

Can't locate DBI.pm in

BEGIN failed--compilation aborted at ./run-all-tests line 36.

I have checked at line 36 in run-all-tests script file and it is

use DBI;

Any one please help me :(

I have the same problem, but after I tried to follow this suggestion:
 "Suggest you try to use the 'ps -aux' to view which process running and kill all the mysql process. To kill the mysql just run "kill -9 pid" should do.

and start the mysql again to see it work or not and post the result here plz."

When i type ps -aux, I don't see any mysql process. Please let me know,

Thanks,

try to start mysql using following command

/usr/local/mysql/bin/mysqld_safe &

Reward 1Reward 2Reward 3Reward 4Reward 5Reward 6

EARN REWARDS FOR ASKING, ANSWERING, AND MORE.

Earn free swag for participating on the platform.


THIS SOLUTION WILL DEFINATELY WORK:

type:
#chown -R mysql /var/lib/mysql/*
#chgrp daemon /var/lib/mysql/*
#chown -R root /var/lib/mysql/*

then start mysqld services
#etc/inet.d/mysqld start

then start mysql, it will work,


-Syed Adeeb
MySQL Server

MySQL Server

--

Questions

--

Followers

Top Experts

MySQL is an open source, relational database management system that runs as a server providing multi-user access to a number of databases. Acquired by Oracle in 2009, it is frequently used in combination with PHP installations, powering most of the WordPress installations.