Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I downloaded mysql-5.1.44.tar.gz and installed it by issuing the following commands:

$ ./configure
$ make
$ make install

Everything installed without any error. Next, I tried to start the mysql server by issuing the following command:

$ mysqld_safe --user=mysql &
100310 13:25:56 mysqld_safe Logging to '/usr/local/var/perfportal2.err'.
100310 13:25:56 mysqld_safe Starting mysqld daemon with databases from /usr/local/var
100310 13:25:56 mysqld_safe mysqld from pid file /usr/local/var/perfportal2.pid ended

$ cat /usr/local/var/myserver.err 
100310 13:25:56 mysqld_safe Starting mysqld daemon with databases from /usr/local/var
/usr/local/libexec/mysqld: Table 'mysql.plugin' doesn't exist
100310 13:25:56 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
100310 13:25:56 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist
100310 13:25:56 mysqld_safe mysqld from pid file /usr/local/var/perfportal2.pid ended

My guess is the installation process did not create the data directory. If you have any idea for me to try out, please help. Thank you.

share|improve this question

2 Answers 2

up vote 3 down vote accepted

If you ran make install and already had the mysql-server package installed, chances are you had a pre-existing mysql database schema in /var/lib/mysql. The version included with RHEL5 is 5.0.77, which could explain the mysql-upgrade error, as that script updates the schema between MySQL versions. The error could also be very similar if you did not create the initial schema as part of your installation.

If you're going to compile from source and not specify installation locations, you need to remove the system packages of mysql first. If you want to maintain both the system packages and the source installation, which there is sometimes argument for, you need to be careful not to stomp all over the system package. That typically means installing your source in a location such as /usr/local/mysql as opposed to the default of /usr/local. You can accomplish this with ./configure --prefix=/usr/local/mysql. There are more details here and best practices that I'm not going to elaborate further on.

While there can be good reasons to compile from source, you might reconsider yours, as it may not be necessary for you.

rpm -qa | grep mysql will display all packages currently installed. Probably mysql-server and mysql-client.

Otherwise, you didn't follow the procedure from the documentation. Even if you did, you will have to repeat it after removing the MySQL packages.

From INSTALL-SOURCE, which was included in the mysql-5.1.44 tarball:

2.3.1. Source Installation Overview

   The basic commands that you must execute to install a MySQL source
   distribution are:
shell> groupadd mysql
shell> useradd -g mysql mysql
shell> gunzip < mysql-VERSION.tar.gz | tar -xvf -
shell> cd mysql-VERSION
shell> ./configure --prefix=/usr/local/mysql
shell> make
shell> make install
shell> cp support-files/my-medium.cnf /etc/my.cnf
shell> cd /usr/local/mysql
shell> chown -R mysql .
shell> chgrp -R mysql .
shell> bin/mysql_install_db --user=mysql
shell> chown -R root .
shell> chown -R mysql var
shell> bin/mysqld_safe --user=mysql &
share|improve this answer
    
Thank you for your help, Warner. I missed the mysql_install_db step. –  Hai Vu Mar 10 '10 at 22:48
  1. Install software from packages!!! Say No to source code compilation. It's 2010 now, you know?
    If there is no package for your software then you should build it yourself.
  2. Error message clearly says that you should run mysql_upgrade
  3. You also can try running mysql_install_db if above doesn't work out.
share|improve this answer
    
I disagree with your first point and I suspect I'm not the only one. Nevertheless, the exampled skill-level does seem more suitable for binary packages. –  Warner Mar 10 '10 at 21:54
    
I completely disagree with your first point also. –  Andy Shellam Mar 10 '10 at 21:55
    
@SaveTheRbtz: Thank you for answering. In this case, I do need to install from source. I also tried to run mysql_upgrade, but failed. The missing step was mysql_install_db. –  Hai Vu Mar 10 '10 at 22:51

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.