I already have an instance of MySQL running a production system. I want to use the same machine to do other MySQL stuff without touching the other instance. I copied my.cnf and rerouted everything (port,datadir,etc). Running mysqld_safe using the new config stopped right away. I looked at the logs. Everything looked good until this line:
[ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist
So, I run mysql_install_db --datadir=my/new/db
and get this:
Installing MySQL system tables... 091120 19:01:24 [ERROR] /usr/libexec/mysqld: unknown option '-e' Installation of system tables failed! Examine the logs in opt/mysqld/data/ for more information. You can try to start the mysqld daemon with: /usr/libexec/mysqld --skip-grant & and use the command line tool /usr/bin/mysql to connect to the mysql database and look at the grant tables: shell> /usr/bin/mysql -u root mysql mysql> show tables Try 'mysqld --help' if you have problems with paths. Using --log gives you a log in opt/mysqld/data/ that may be helpful. The latest information about MySQL is available on the web at http://www.mysql.com Please consult the MySQL manual section: 'Problems running mysql_install_db', and the manual section that describes problems on your OS. Another information source is the MySQL email archive. Please check all of the above before mailing us! And if you do mail us, you MUST use the /usr/bin/mysqlbug script!
I'm not giving a -e option on my call. What do I do?
EDIT: I followed the instructions in the error and get access denied for 'root'@'localhost'. The server is running and the appropriate port is listening. How do I log-in after doing a skip-grant?
I'm not sure what the -e error means, but you should be able to restart MySQL with a --skip-grant-tables option and manually populate (and create) the tables if you're running into issues.
The SQL files exist under /usr/share/mysql, at least on RHEL 5. They're installed in the following order:
mysql_system_tables.sql
mysql_system_tables_data.sql
fill_help_tables.sql
Note that there is a 'sed' command that replaces '@current_hostname' in those files with your actual hostname. The install database script also creates the test & mysql database directories using 'mkdir' and sets the appropriate ownership and permissions.
mysql_install_db --datadir=my/new/db
uses a relative path. It worked when I used an absolute path.