mysql can't running

Michael Powell nightrecon at
Wed Mar 24 00:13:10 UTC 2010

m.anis wrote:

> Please help, mysql can't running
> i had installed it and using phpmyadmin
> when i check /etc/rc.d/mysql-server status
> it says mysql is not running

phpMyAdmin will not work until you have configured correctly.

> when i tried /usr/local/bin/mysqld_safe &
> startting mysqld daemon with database from /var/db/mysql
> STOPPING server from pid file /var/db/mysql/<myhost>.pid
> 100323 22:09:46  mysqld ended

This is not the correct method to start mysql. You will need to place 
mysql_enable="YES" into /etc/rc.conf for the startup scripts to work 
properly. It will also require typing the entire path to the startup script 
on the command line as well, such as: /usr/local/etc/rc.d/mysql-server 
start. Or stop, or restart, as you may need. This should occur automatically 
when booting the machine and this command line is only necessary should you 
desire to start, stop, or restart without a reboot.

Since it said it was 'STOPPING' the server above, how do you know it wasn't 
running? Instead of phpMyAdmin why not simply do a ps -ax? If mysql is 
running you will see a couple of line such as:

  725  v0- I      0:00.01 /bin/sh /usr/local/bin/mysqld_safe --defaults-
extra-file=/var/db/mysql/my.cnf --user=my
  858  v0- I      0:20.83 /usr/local/libexec/mysqld --defaults-extra-
file=/var/db/mysql/my.cnf --basedir=/usr/loc

Lines are cut and word-wrapped, but you get the idea.

More information may be gleaned from /var/db/mysql/<machinehostname>.err, 
this is the mysql error log. Determine properly first whether mysql is 
actually running, or not. 

The installation procedure (if done properly, and NOT just simply unzipping 
a tarball somewhere and doing ./configure && make && make install, e.g 
either using the ports building or package installing process) will also 
create a mysql user and group entry.  The mysql subdirectory and all files 
under it should be owned by this user:group, e.g.: mysql:mysql. If you did 
NOT use the ports or package install process, just stop, back up the train 
and remove whatever you did. Start over and use the ports or package install 

The config file is named my.cnf and lives in /usr/local/etc. MySQL will 
ignore this file if it is world writable. It should fall back to using one 
located elsewhere if it can locate one. Not sure as I don't believe I've 
ever attempted starting MySQL with no my.cnf at all, but I believe it may 
start whether this file is present, or not. Could be wrong about that.

If you should find that it is actually running but you are having difficulty 
communicating with it you may need to do an initial configuration to it to 
allow logins. Initially when first installed there is no root password and 
the first step involves setting a password and setting up some basic grant 


More information about the freebsd-questions mailing list