前几天群里有个人问我编译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 可以启动了~