创 建用户和组:之前已经创建了
groupadd mysql
useradd -g mysql mysql

cd /home/mysql
chown -R root .
chgrp -R mysql .
样例说明:
# chown -R root . #设定root能访问/home/mysql
# chown -R mysql var #设定mysql用户能访问/usr/local/mysql/var ,里面存的是mysql的数据库文件
# chown -R mysql var/. #设定mysql用户能访问/usr/local/mysql/var下的所有文件
# chown -R mysql var/mysql/. #设定mysql用户能访问/usr/local/mysql/var/mysql下的所有文件
# chgrp -R mysql . #设定mysql组能够访问/home/mysql

再 来一步:
/usr/bin/mysql -u root mysql
发现还有一个错误:
Table 'mysql.plugin' doesn't exist

修改了my.cnf
#basedir        = /usr
#datadir        = /var/lib/mysql
basedir         = /home/mysql
datadir         = /home/mysql/data

再次执行:tech80192:/home/mysql# /home/mysql/bin/mysql_install_db --user=mysql
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:

/home/mysql/bin/mysqladmin -u root password 'new-password'
/home/mysql/bin/mysqladmin -u root -h tech80192 password 'new-password'

Alternatively you can run:
/home/mysql/bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:
cd /home/mysql ; /home/mysql/bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl
cd /home/mysql/mysql-test ; perl mysql-test-run.pl

Please report any problems with the /home/mysql/scripts/mysqlbug script!

good,成功啦!

别 管那么多了,启动试试:
/home/mysql/bin/mysqld_safe --user=mysql &
又来:
100826 21:06:46 [ERROR] Can't start server : Bind on unix socket: Permission denied
100826 21:06:46 [ERROR] Do you already have another mysqld server running on socket: /var/run/mysqld/mysqld.sock ?
100826 21:06:46 [ERROR] Aborting

权限问题,
前面说的
mkdir -p /home/mysql/var/run/mysqld/
cd /home/mysql
chgrp -R mysql .
chown -R mysql:mysql var

再修改my.cnf
全部:/var/run/mysqld/mysqld.sock
改 为:/home/mysql/var/run/mysqld/mysqld.sock

别再逼我,最后一次启动了:
tech80192:/home/mysql# /home/mysql/bin/mysqld_safe --user=mysql &
[1] 3789
tech80192:/home/mysql# 100826 21:22:40 mysqld_safe Logging to '/home/mysql/data/tech80192.err'.
100826 21:22:40 mysqld_safe Starting mysqld daemon with databases from /home/mysql/data
奇迹呀:
tech80192:/home/mysql# ps -eff | grep mysql | grep -v "grep"
root      3789  5013  0 21:22 pts/1    00:00:00 /bin/sh /home/mysql/bin/mysqld_safe --user=mysql
mysql     3977  3789  0 21:22 pts/1    00:00:00 /home/mysql/libexec/mysqld --basedir=/home/mysql --datadir=/home/mysql/data --user=mysql --log-error=/home/mysql/data/tech80192.err --pid-file=/home/mysql/var/run/mysqld/mysqld.pid --socket=/home/mysql/var/run/mysqld/mysqld.sock --port=3306

第一章 MySql的安装 1.2_第1张图片
到此为止吧,听听歌,爽一把先!