从网址http://www.mysql.com/downloads/下载mysql压缩包mysql-5.6.4-m7.tar.gz
1、解压:tar zxvf mysql-5.6.4-m7.tar.gz
2、进入mysql-5.6.4-m7,并创建BUILD目录:mkdir BUILD
3、进入目录:cd BUILD
4、配置:cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql-DMYSQL_UNIX_ADDR=/data/mysql/mysql.sock
-DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci-DWITH_EXTRA_CHARSETS:STRING=utf8,gbk
-DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1
-DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_READLINE=1
-DENABLED_LOCAL_INFILE=1 -DMYSQL_DATADIR=/data/mysql
-DMYSQL_USER=mysql -DMYSQL_TCP_PORT=3306 ..
5、编译:make
6、安装:make install
7、复制配置文件到etc:cp ./support-files/my-medium.cnf /etc/my.cnf
8、初始化mysql:./scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql/
9、启动mysql:./mysqld_safe
10、设置root账户密码:./mysqladmin -uroot password 'yourpassword'
11、连接mysql:./mysql -uroot -p