http://dev.mysql.com/downloads/mysqlhtml
選擇Source Code
mysql
yum -y install gcc gcc-c++ gcc-g77 autoconf automake zlib* fiex* libxml* ncurses-devel libmcrypt* libtool-ltdl-devel* make cmake
groupadd mysql useradd -r -g mysql mysql
tar -zxvf mysql-5.6.20.tar.gz cd mysql-5.6.20 #默認狀況下是安裝在/usr/local/mysql cmake . make && make install
cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \ -DMYSQL_DATADIR=/usr/local/mysql/data \ -DSYSCONFDIR=/etc \ -DWITH_MYISAM_STORAGE_ENGINE=1 \ -DWITH_INNOBASE_STORAGE_ENGINE=1 \ -DWITH_MEMORY_STORAGE_ENGINE=1 \ -DWITH_READLINE=1 \ -DMYSQL_UNIX_ADDR=/var/lib/mysql/mysql.sock \ -DMYSQL_TCP_PORT=3306 \ -DENABLED_LOCAL_INFILE=1 \ -DWITH_PARTITION_STORAGE_ENGINE=1 \ -DEXTRA_CHARSETS=all \ -DDEFAULT_CHARSET=utf8 \ -DDEFAULT_COLLATION=utf8_general_ci
編譯的參數能夠參考http://dev.mysql.com/doc/refman/5.6/en/source-configuration-options.htmlc++
chown -R mysql.mysql /usr/local/mysql
cd /usr/local/mysql/scripts ./mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
cd /usr/local/mysql/support-files #註冊服務 cp mysql.server /etc/rc.d/init.d/mysql #使用默認配置文件 cp my-default.cnf /etc/my.cnf #讓chkconfig管理mysql服務 chkconfig --add mysql #開機啓動 chkconfig mysql on
service mysql start
SHOW VARIABLES LIKE 'character%'
修改mysql的my.cnf文件sql
[client] default-character-set=utf8 [mysqld] character-set-server=utf8 [mysql] default-character-set=utf8
cd ~ #我把path添加到當前用戶目錄的bashrc中,若是須要全局設定,請修改`/etc/profile` vi .bashrc #加入如下內容 PATH=/usr/local/mysql/bin:$PATH export PATH
mysql -uroot SET PASSWORD = PASSWORD('123456'); GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;
參考: http://blog.163.com/liyinhui20080527@126/blog/static/815232582013885310900/ http://www.cnblogs.com/xiongpq/p/3384681.html數據庫