我试图在 Debian 6 中从源代码编译 MySQL 5.5.15,并使用“老式”的方法:即在 BUILD 中运行 autorun.sh,然后使用相当多的选项运行 ./configure,当我尝试启动该过程时,我看到的是:
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Restoring possible half-written data pages from the doublewrite
InnoDB: buffer...
InnoDB: Doing recovery: scanned up to log sequence number 1595675
110816 9:36:06 InnoDB: Starting an apply batch of log records to the database...
InnoDB: Progress in percents: 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
InnoDB: Apply batch completed
110816 9:36:06 InnoDB: Waiting for the background threads to start
110816 9:36:07 InnoDB: 1.1.8 started; log sequence number 1595675
110816 9:36:07 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist
110816 09:36:07 mysqld_safe mysqld from pid file /usr/local/mysql/data/myhost.pid ended
以下是./configure
我使用过的选项:
./configure --prefix=/usr/local/mysql --with-extra-charsets=all\
--enable-thread-safe-client --enable-assembler \
--with-charset=utf8 --enable-thread-safe-client \
--with-extra-charsets=all
make && make install && make install scripts
我也运行了 install db:
/usr/local/mysql/scripts/mysql_install_db --user=mysql \
--basedir=/usr/local/mysql --datadir=/usr/local/mysql/var
添加了所有权已发生改变,但问题仍然存在:
ls -la
total 20
drwx--S--- 5 mysql mysql 4096 Aug 16 09:25 .
drwxr-sr-x 14 mysql mysql 4096 Aug 16 09:25 ..
drwx--S--- 2 mysql mysql 4096 Aug 16 09:25 mysql
drwx--S--- 2 mysql mysql 4096 Aug 16 09:25 performance_schema
drwx--S--- 2 mysql mysql 4096 Aug 16 09:25 test
你能帮忙吗?谢谢!
答案1
这是关键
[ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist
确保数据目录用户是mysql
chown -R mysql.mysql /usr/local/mysql/var
还要检查确保您的数据目录实际上包含 mysql 数据库及其应使用安装脚本创建的默认表。
答案2
请使用 cmake 而不是 autotools。 http://dev.mysql.com/doc/mysql-sourcebuild-excerpt/5.5/en/source-configuration-options.html
MySQL 开发人员使用 5.5 分支的 cmake,并且不再支持“configure”。