View previous topic :: View next topic |
Author |
Message |
thecooptoo Veteran
Joined: 27 Apr 2003 Posts: 1353 Location: UK
|
Posted: Wed Dec 17, 2003 10:51 pm Post subject: where has mysql gone ? |
|
|
where do i get /var/run/mysqld/mysqld.sock from
router mysql # mysql -u root -p
Enter password:
ERROR 2002: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
router mysql # /etc/init.d/mysql status
* status: started
router mysql # ps -A |grep mysql
router mysql # netstat -an | grep 3306
router mysql # lsof -i :mysql | grep LISTEN
router mysql # lsof /var/run/mysqld/mysqld.sock
lsof: status error on /var/run/mysqld/mysqld.sock: No such file or directory
router run # pwd
/var/run
router run # ls -l |grep my
drwxr-xr-x 2 mysql mysql 4096 Dec 17 23:57 mysqld
router mysqld # pwd
/var/run/mysqld
router mysqld # ls -l
total 0
router mysqld #
router files # find / -name *sock
/var/run/cgisock
/usr/portage/net-misc/sock |
|
Back to top |
|
|
Oopsz Guru
Joined: 08 Oct 2002 Posts: 340
|
Posted: Wed Dec 17, 2003 11:25 pm Post subject: |
|
|
sounds like it didn't start up. /etc/init.d/mysql zap && /etc/init.d/mysql start, and then ps aux|grep mysql. if its not running, then there's something in the config that's keeping it from launching. _________________ Pop-before-SMTP with the Gentoo Virtual Mailhosting Guide |
|
Back to top |
|
|
thecooptoo Veteran
Joined: 27 Apr 2003 Posts: 1353 Location: UK
|
Posted: Wed Dec 17, 2003 11:27 pm Post subject: |
|
|
router files # /etc/init.d/mysql zap && /etc/init.d/mysql start
* Manually resetting mysql to stopped state.
* Starting mysqld... [ ok ]
router files # ps aux|grep mysql
root 19549 0.0 0.2 1372 456 pts/0 S 00:30 0:00 grep mysql
router files # mysql -u root -p
Enter password:
ERROR 2002: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
router files # |
|
Back to top |
|
|
tomk Bodhisattva
Joined: 23 Sep 2003 Posts: 7221 Location: Sat in front of my computer
|
Posted: Thu Dec 18, 2003 12:41 am Post subject: |
|
|
Is there anything in the logs? Have a look at /var/log/mysql/mysql.err _________________ Search | Read | Answer | Report | Strip |
|
Back to top |
|
|
Oopsz Guru
Joined: 08 Oct 2002 Posts: 340
|
|
Back to top |
|
|
thecooptoo Veteran
Joined: 27 Apr 2003 Posts: 1353 Location: UK
|
Posted: Thu Dec 18, 2003 7:34 am Post subject: |
|
|
router root # /etc/init.d/status
-bash: /etc/init.d/status: No such file or directory
router root # /etc/init.d/mysql status
* status: started
router root # mysql -u root -p
Enter password:
ERROR 2002: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
router root #
would sem to indicate it is - but where is going?
Or why cant i connetc to it?
AFAIK mysqld.sock is created dynamically
when and by what? |
|
Back to top |
|
|
Oopsz Guru
Joined: 08 Oct 2002 Posts: 340
|
Posted: Thu Dec 18, 2003 11:21 am Post subject: |
|
|
if it doesn't show up in ps aux, it's not running, despite what the rc script thinks.
1) zap the init script. 2) what's in your my.cnf? _________________ Pop-before-SMTP with the Gentoo Virtual Mailhosting Guide |
|
Back to top |
|
|
MagicMonkey n00b
Joined: 17 Dec 2003 Posts: 37 Location: UK
|
Posted: Thu Dec 18, 2003 2:30 pm Post subject: |
|
|
It sounds like mysql is starting up, but then dying for some reason. Have you only just installed it? My guess is that you haven't created it's initial database (it needs a privs database to start up). There's a script for doing this called something like install-db.sh which needs to be run before mysql will start.
The messages in the error log should give you more of an idea of what's happening; it's probably at /var/log/mysql/mysql.err |
|
Back to top |
|
|
thecooptoo Veteran
Joined: 27 Apr 2003 Posts: 1353 Location: UK
|
Posted: Thu Dec 18, 2003 8:28 pm Post subject: |
|
|
having restarted the server ( but ive done that before since having this problem) I can now access the mysql server.
I removed everything from /var/lib/mysql/ & ran mysql_install_db.
It has recreated all the tables in /var/lib/mysql/mysql/
however i cant access anything as root.
router mysql # mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 18 to server version: 4.0.14
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> use mysql
ERROR 1044: Access denied for user: 'root@' to database 'mysql'
mysql>
when i try to creae a new database using webmin
i get
Failed to create database : DBI connect failed : Access denied for user: 'root@' to database 'mysql'
ie the root user doesnt have permission to access the mysql DB ( which the one that stores privileges (isnt it?)
So how do i get my root user to get access to the mysql DB & tables?
ive tried chowning everything to root and chmodding to 777 , which didnt solve it.
router mysql # cat my.cnf |grep -v '#'
[client]
port = 3306
socket = /var/run/mysqld/mysqld.sock
[safe_mysqld]
err-log = /var/log/mysql/mysql.err
[mysqld]
skip-innodb
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
log-error = /var/log/mysql/mysqld.err
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
language = /usr/share/mysql/english
skip-locking
set-variable = key_buffer=16M
set-variable = max_allowed_packet=1M
set-variable = thread_stack=128K
bind-address = 127.0.0.1
port = 3306
[mysqldump]
quick
set-variable = max_allowed_packet=1M
[mysql]
[isamchk]
set-variable = key_buffer=16M
router mysql # |
|
Back to top |
|
|
MagicMonkey n00b
Joined: 17 Dec 2003 Posts: 37 Location: UK
|
Posted: Fri Dec 19, 2003 3:37 pm Post subject: |
|
|
Try typing the following:
mysql -u root -h localhost mysql
and see what happens. Good luck... |
|
Back to top |
|
|
MagicMonkey n00b
Joined: 17 Dec 2003 Posts: 37 Location: UK
|
Posted: Fri Dec 19, 2003 3:51 pm Post subject: ps... |
|
|
Quote: | ive tried chowning everything to root and chmodding to 777 , which didnt solve it. |
By the way, the MySQL root user is not the same as the local root user (MySQL uses it's own authentication method); the database will be running as a user "mysql" which will need access to the actual database files.
If things have got screwed up, here's a bit of a "role-back-and-start-again" recovery procedure:
1) Stop the database daemon (/etc/init.d/mysql stop)
2) Delete everything from the data directory (rm -r /var/lib/mysql)
3) Re-run mysql_install_db
4) Start the database daemon again (/etc/init.d/mysql start)
5) Login as root with no password (mysql -u root)
6) See if it'll let you at the mysql database (use mysql)
Then you should be able to use Webmin; please make sure that the first thing you do is set the MySQL root password...
If anything fails, check the error log (/var/log/mysql/mysqld.err) |
|
Back to top |
|
|
thecooptoo Veteran
Joined: 27 Apr 2003 Posts: 1353 Location: UK
|
Posted: Fri Dec 19, 2003 6:10 pm Post subject: |
|
|
many thanks :D :D .
Now to try phpwebsite/phpnuke/ etc etc |
|
Back to top |
|
|
eltech Guru
Joined: 05 Nov 2002 Posts: 582 Location: New York
|
Posted: Thu Aug 26, 2004 1:18 pm Post subject: Re: ps... |
|
|
MagicMonkey wrote: | Quote: | ive tried chowning everything to root and chmodding to 777 , which didnt solve it. |
By the way, the MySQL root user is not the same as the local root user (MySQL uses it's own authentication method); the database will be running as a user "mysql" which will need access to the actual database files.
If things have got screwed up, here's a bit of a "role-back-and-start-again" recovery procedure:
1) Stop the database daemon (/etc/init.d/mysql stop)
2) Delete everything from the data directory (rm -r /var/lib/mysql)
3) Re-run mysql_install_db
4) Start the database daemon again (/etc/init.d/mysql start)
5) Login as root with no password (mysql -u root)
6) See if it'll let you at the mysql database (use mysql)
Then you should be able to use Webmin; please make sure that the first thing you do is set the MySQL root password...
If anything fails, check the error log (/var/log/mysql/mysqld.err) | Dude .. you dont know what i was going through to get this all set up .. jeez ..
thanks much man ..
you need something stronger than n00b under your name, many people cant help halfway through what you just stepped me through .. outstanding |
|
Back to top |
|
|
|