[root@test scripts]# pwd
/usr/local/MySQL/scripts
[root@test scripts]# ll
total 16
-rwxr-xr-x. 1 mysql mysql 14816 Jul 13 14:50 mysql_install_db
[root@test scripts]#./mysql_install_db --datadir=/data1/mysql_db/
[root@test ~]#chown -R mysql:mysql /data1/mysql_db/ #根据具体情况决定做不做这一步。
------------------------------------------------------------------------------------------
注意:
------------------------------------------------------------------------------------------
注意:启动MySQL时出现以下错误:
[root@test ~]# service mysqld start
Starting MySQL.The server quit without updating PID file (/[FAILED]mysql/mysql.pid).
[root@test ~]# tail /var/log/mysql.log
120713 16:41:36 mysqld_safe Starting mysqld daemon with databases from /data1/mysql_db
/usr/local/mysql/bin/mysqld: Character set 'all' is not a compiled character set and is not specified in the '/usr/local/mysql/share/charsets/Index.xml' file
120713 16:41:36 [ERROR] Aborting
120713 16:41:36 [Note] /usr/local/mysql/bin/mysqld: Shutdown complete
120713 16:41:36 mysqld_safe mysqld from pid file /var/run/mysql/mysql.pid ended
[root@test ~]#
[mysqld]
character-set-server = utf8
(9)设置 mysql 用户 root 的密码
[root@test ~]# mysqladmin -u root -p password 123456
[root@test ~]# mysql -u root -p -S /tmp/mysql.sock
Enter password: <-----输入上面设置的数据库管理员密码:123456,回车即可登录数据库。
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.5.25a-log Source distribution
Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
如下图:

在初始化 mysql 数据库后,其中默认生成了4个数据库;每个数据库下都会有若干个表。
