今天我升級MySQL到5.1的時候遇到的。寫出來共享以下。
1、
[root@localhost mysql]# scripts/MySQL_install_db
Neither host 'localhost.localdomain' nor 'localhost' could be looked up with
/resolveip
Please configure the 'hostname' command to return a correct
hostname.
If you want to solve this at a later stage, restart this script
with the --force option
這個主要是修改/etc/hosts文件
echo "127.0.0.1 localhost.localdomain localhost" >> /etc/hosts
然後再初始化數據,如果還是同樣的錯誤,那就直接加--force開關。
我今天碰到的就是這個情況。
[root@localhost mysql]# scripts/MySQL_install_db --force
Installing MySQL system tables...
OK
Filling help tables...
OK
To start MySQLd at boot time you have to copy
support-files/MySQL.server to the right place for your system
PLEASE REMEMBER TO SET A PASSWord FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/local/mysql//bin/MySQLadmin -u root password 'new-passWord'
/usr/local/mysql//bin/MySQLadmin -u root -h localhost.localdomain password 'new-passWord'
See the manual for more instructions.
You can start the MySQL daemon with:
cd . ; /usr/local/mysql//bin/MySQLd_safe &
You can test the MySQL daemon with MySQL-test-run.pl
cd mysql-test ; perl MySQL-test-run.pl
Please report any problems with the ./bin/MySQLbug script!
The latest information about MySQL is available on the web at
http://www.MySQL.com
Support MySQL by buying support/licenses at http://shop.MySQL.com
這樣就成功初始化數據了。
2、編碼文件鏈接丟失。
[root@localhost mysql]# scripts/MySQL_install_db --force
Installing MySQL system tables...
071129 13:38:08 [ERROR] Can't find messagefile '/usr/local/MySQL/share/english/errmsg.sys'
071129 13:38:08 [ERROR] Aborting
071129 13:38:08 [Note]
Installation of system tables failed!
Examine the logs in /usr/local/MySQL/data/ for more information.
You can try to start the MySQLd daemon with:
/usr/local/mysql//bin/MySQLd --skip-grant &
and use the command line tool
/usr/local/mysql//bin/mysql to connect to the MySQL
database and look at the grant tables:
shell> /usr/local/mysql//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/MySQL/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 ./bin/MySQLbug script!
解決:
今天發現MySQL官方5.1.22 對這個BUG進行了修正。
MySQL_install_db could fail to find its message file. (Bug#30678)
[root@localhost mysql]# ln -s /usr/local/mysql/share/mysql/english/ /usr/local/MySQL/share/english
[root@localhost mysql]# scripts/MySQL_install_db --force
Installing MySQL system tables...
OK
Filling help tables...
OK
To start MySQLd at boot time you have to copy
support-files/MySQL.server to the right place for your system
PLEASE REMEMBER TO SET A PASSWord FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/local/mysql//bin/MySQLadmin -u root password 'new-passWord'
/usr/local/mysql//bin/MySQLadmin -u root -h localhost.localdomain password 'new-passWord'
See the manual for more instructions.
You can start the MySQL daemon with:
cd . ; /usr/local/mysql//bin/MySQLd_safe &
You can test the MySQL daemon with MySQL-test-run.pl
cd mysql-test ; perl MySQL-test-run.pl
Please report any problems with the ./bin/MySQLbug script!
The latest information about MySQL is available on the web at
http://www.MySQL.com
Support MySQL by buying support/licenses at http://shop.MySQL.com
正常啟動
[root@localhost mysql]# /usr/local/mysql/bin/MySQLd_safe &
[1] 2680
[root@localhost mysql]# 071129 13:45:16 mysqld_safe Logging to '/usr/local/MySQL/data//localhost.localdomain.err'.
/usr/local/mysql/bin/MySQLd_safe: line 366: [: -eq: unary Operator expected
071129 13:45:16 mysqld_safe Starting mysqld daemon with databases from /usr/local/MySQL/data/
ps aux | grep MySQL
root 2680 0.0 0.1 4684 1144 pts/0 S 13:45 0:00 /bin/sh /usr/local/mysql/bin/MySQLd_safe
nobody 2748 1.6 1.7 108948 16796 pts/0 Sl 13:45 0:00 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data/ --user=nobody --log-error=/usr/local/mysql/data//localhost.localdomain.err --pid-file=/usr/local/mysql/data//localhost.localdomain.pid --socket=/tmp/MySQL.sock --port=3306
root 2762 0.0 0.0 4120 668 pts/0 S+ 13:45 0:00 grep MySQL
2、用 MySQLdumpshow時遇到的錯誤:
[root@localhost bin]# MySQLdumpslow
Can't determine basedir from 'my_print_defaults MySQLd' output: --max-allowed-packet=100M
export PATH=$PATH:/usr/local/MySQL/bin
就可以解決。