yum install libaio-devel ncurses -y
===========================================
mkdir /opt/tools -p
cd /opt/tools
groupadd mysql
useradd -s /sbin/nologin -M mysql -g mysql
tar xf mysql-5.5.32-linux2.6-x86_64.tar.gz
mv mysql-5.5.32-linux2.6-x86_64 /opt/mysql-5.5.32
ln -s /opt/mysql-5.5.32/ /opt/mysql
chown -R mysql.mysql /opt/mysql/
cd /opt/mysql
/opt/mysql/scripts/mysql_install_db --basedir=/opt/mysql/ --datadir=/opt/mysql/data/ --user=mysql
/bin/cp /opt/mysql/support-files/my-small.cnf /etc/my.cnf
sed -i 's#/usr/local/mysql#/opt/mysql#g' /opt/mysql/bin/mysqld_safe
/opt/mysql/bin/mysqld_safe &
echo "PATH="/opt/mysql/bin:$PATH"" >>/etc/profile
source /etc/profile
cp support-files/mysql.server /etc/init.d/mysqld
sed -i 's#/usr/local/mysql#/opt/mysql#g' /etc/init.d/mysqld
chmod +x /etc/init.d/mysqld
killall mysqld
/etc/init.d/mysqld start
netstat -lntup |grep mysql
chkconfig --add mysqld
chkconfig mysqld on
chkconfig --list mysqld
echo "/etc/init.d/mysqld start" >>/etc/rc.local
安装完毕
======================================================
#mysql
show databases;
select user();
exit
# mysqladmin -u root password '密码'
# mysql -uroot -p
select user,host from mysql.user;
设置root密码完毕
==========================================================
grant all PRIVILEGES on *.* to 用户@'%' identified by '密码';
#授权用户kaitaiming对所有库所有的权限
flush privileges;
原文地址:http://blog.51cto.com/guoshaoliang789/2106527