Search the MySQL manual:

2.4.1 Problems Running mysql_install_db

The purpose of the mysql_install_db script is to generate new MySQL privilege tables. It will not affect any other data. It will also not do anything if you already have MySQL privilege tables installed.

If you want to re-create your privilege tables, you should take down the mysqld server, if it's running, and then do something like:

mv mysql-data-directory/mysql mysql-data-directory/mysql-old
mysql_install_db

This section lists problems you might encounter when you run mysql_install_db:

mysql_install_db doesn't install the grant tables
You may find that mysql_install_db fails to install the grant tables and terminates after displaying the following messages:
starting mysqld daemon with databases from XXXXXX
mysql daemon ended
In this case, you should examine the log file very carefully. The log should be located in the directory `XXXXXX' named by the error message, and should indicate why mysqld didn't start. If you don't understand what happened, include the log when you post a bug report using mysqlbug. See section 1.7.1.3 How to Report Bugs or Problems.
There is already a mysqld daemon running
In this case, you probably don't have to run mysql_install_db at all. You have to run mysql_install_db only once, when you install MySQL the first time.
Installing a second mysqld daemon doesn't work when one daemon is running
This can happen when you already have an existing MySQL installation, but want to put a new installation in a different place (for example, for testing, or perhaps you simply want to run two installations at the same time). Generally the problem that occurs when you try to run the second server is that it tries to use the same socket and port as the old one. In this case you will get the error message: Can't start server: Bind on TCP/IP port: Address already in use or Can't start server: Bind on unix socket.... See section 4.1.3 Running Multiple MySQL Servers on the Same Machine.
You don't have write access to `/tmp'
If you don't have write access to create a socket file at the default place (in `/tmp') or permission to create temporary files in `/tmp,' you will get an error when running mysql_install_db or when starting or using mysqld. You can specify a different socket and temporary directory as follows:
shell> TMPDIR=/some_tmp_dir/
shell> MYSQL_UNIX_PORT=/some_tmp_dir/mysqld.sock
shell> export TMPDIR MYSQL_UNIX_PORT
See section A.4.5 How to Protect or Change the MySQL Socket File `/tmp/mysql.sock'. `some_tmp_dir' should be the path to some directory for which you have write permission. See section F Environment Variables. After this you should be able to run mysql_install_db and start the server with these commands:
shell> scripts/mysql_install_db
shell> BINDIR/mysqld_safe &
mysqld crashes immediately
If you are running Red Hat Version 5.0 with a version of glibc older than 2.0.7-5, you should make sure you have installed all glibc patches. There is a lot of information about this in the MySQL mail archives. Links to the mail archives are available online at http://lists.mysql.com/. Also, see section 2.6.2 Linux Notes (All Linux Versions). You can also start mysqld manually using the --skip-grant-tables option and add the privilege information yourself using mysql:
shell> BINDIR/mysqld_safe --skip-grant-tables &
shell> BINDIR/mysql -u root mysql
From mysql, manually execute the SQL commands in mysql_install_db. Make sure you run mysqladmin flush-privileges or mysqladmin reload afterward to tell the server to reload the grant tables.

User Comments

Posted by sean barkow on Saturday November 16 2002, @9:35pm[Delete] [Edit]

i don't even have a file in any of the mysql folders
that is called mysql_install_db. Where is it? the Why
was it not included in the download? The server will
start as a service on my xp system, but i cannot do
anything else until i run this script. But, it's nowhere
to be found. Please advise.

Posted by Mike Henry on Friday November 29 2002, @3:45pm[Delete] [Edit]

I don't have mysql_install_db either. I'm just trying
to get it up and running to see if I like mySQL and
the file I am supposed to run is not even there. I am
going to assume for a while it is my fault somehow
since I am new to this product. But, if anybody is
aware that this is a real problem please let me know.

mike@henrynet.com

Thanks.

Posted by [name withheld] on Friday March 21 2003, @3:09pm[Delete] [Edit]

Make sure you check the bin directory of the base of your installation. So, if you installed into /usr/local/mysql, check /usr/local/mysql/bin. That's where mine landed when I complied from source on a Solaris 9 box.

Posted by Shanti Suresh on Thursday April 17 2003, @8:31am[Delete] [Edit]

I installed in a non-standard location from a binary distribution, and "mysql_install_db" looks to find
"stuff" in the original default location of
"/usr/local/mysql".
may I add a [mysql_install_db] section in "/etc/my.cnf"
file to circumvent the issue?

Add your own comment.