1,useradd -s /sbin/nologin mysql
2,mkdir -p /data/mysql/data
3,chown -R mysql:mysql /data/mysql
4,yum install gcc gcc-c++ cmake ncurses-devel bison
5,wget http://ncu.dl.sourceforge.net/project/mysql.mirror/MySQL%205.5.28/mysql-5.5.28.tar.gz
6,tar xzvf mysql-5.5.28.tar.gz
7,cd mysql-5.5.28
//相当于以前的./configure
8,cmake -DMYSQL_USER=mysql -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DINSTALL_DATADIR=/data/mysql/data -DMYSQL_UNIX_ADDR=/tmp/mysqld.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DEXTRA_CHARSETS=all -DWITH_EMBEDDED_SERVER=1 -DENABLED_LOCAL_INFILE=1 -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1
9,make && make install
10,chown -R mysql:mysql /usr/local/mysql/
11,mv /root/mysql-5.5.28/support-files/my-large.cnf /etc/my.cnf
12,mv /root/mysql-5.5.28/support-files/mysql.server /etc/init.d/mysqld
13,chmod a+x /etc/init.d/mysqld
14,chkconfig --level 345 mysqld on
15,echo "export PATH=/usr/local/mysql/bin/:$PATH" >> /etc/profile
16,source /etc/profile
17,/usr/local/mysql/scripts/mysql_install_db --user=mysql --defaults-file=/etc/my.cnf --basedir=/usr/local/mysql --datadir=/data/mysql/data
18,vim /etc/my.cnf
19,在[mysqld]处添加
basedir=/usr/local/mysql
datadir=/data/mysql/data
20,service mysqld start
21,/usr/local/mysql/bin/mysqladmin -u root password '123'
22,mysql -u root -p123
====分割线====
//mysql实现远程链接 your paaaword 为你的密码 root为你的账号 %不限定连接的ip
mysql>GRANT ALL PRIVILEGES ON *.* TO root@'%' IDENTIFIED BY 'your paaaword';
mysql>GRANT ALL on *.* to root@192.168.0.% IDENTIFIED BY 'your paaaword';
mysql安装相关链接
http://blog.chinaunix.net/uid-26931379-id-3193926.html