天天看點

mysql初始化失敗

        前幾天群裡有個人問我編譯mysql初始化失敗的錯誤,自己當時的确遇到過那個錯誤,當時沒想起來,對不起,今天自己測試tcmalloc,也遇到那個錯誤,想起了怎麼解決這個錯誤,順便做下筆記~,我的安裝順序如下

1.shell $> groupadd mysql

2.shell $> useradd -g mysql mysql

3.shell $> tar zxvf  mysql-5.1.32.tar.gz

4.shell $> cd mysql-5.1.32

5.shell $> CFLAGS="-O3 -mpentiumpro" CXX=gcc CXXFLAGS="-O3 -mpentiumpro -fno-exceptions -fno-rtti"

shell $> ./configure  --prefix=/usr/local/mysql --with-charset=utf8 --with-collation=utf8_general_ci --enable-thread-safe-client --with-extra-charsets=gbk,latin1 --with-client-ldflags=-all-static --enable-assembler --with-unix-socket-path=/usr/local/mysql/var/mysql.sock --sysconfdir=/usr/local/mysql/etc  --disable-shared  --without-debug --enable-largefile --with-big-tables --without-uca --with-mysqld-user=mysql --with-pthread --with-pstack

#為了使用tcmalloc提升mysql性能,隻能去掉靜态模式

如果你不使用tcmalloc

加上這句參數 -with-mysqld-ldflags=-all-static

6.shell $> make && make install

7.shell $> cd /usr/local/mysql

8.shell $> mkdir etc

  shell $> cp share/mysql/my-medium.cnf etc/my.cnf

9.shell $>bin/mysql_install_db --user=mysql

結果出現了錯誤,錯誤如下:

090312 15:57:28 [ERROR] /usr/local/mysql5/libexec/mysqld: unknown option '--skip-federated'

090312 15:57:28 [ERROR] Aborting

090312 15:57:28 [Note] /usr/local/mysql5/libexec/mysqld: Shutdown complete

Installation of system tables failed!  Examine the logs in

/usr/local/mysql5/var for more information.

You can try to start the mysqld daemon with:

    shell> /usr/local/mysql5/libexec/mysqld --skip-grant &

and use the command line tool /usr/local/mysql5/bin/mysql

to connect to the mysql database and look at the grant tables:

    shell> /usr/local/mysql5/bin/mysql -u root mysql

    mysql> show tables

Try 'mysqld --help' if you have problems with paths.  Using --log

gives you a log in /usr/local/mysql5/var that may be helpful.

The latest information about MySQL is available . 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 . your OS.  Another information source are the

MySQL email archives available at http://lists.mysql.com/.

Please check all of the above before mailing us!  And remember, if

you do mail us, you MUST use the /usr/local/mysql5/bin/mysqlbug .!

10.解決此錯誤,修改 my.cnf

注釋掉 skip-federated

然後在初始化,問題解決了~

希望我能幫編譯安裝mysql遇到同樣錯誤的人~~

11.shell $> chown root . -R

12.shell $> chown mysql var -R

13.shell $> chgrp mysql . -R

14.shell $> bin/mysqld_safe --user=mysql  &

好了mysql 可以啟動了~