全部博文(103)
分类: Mysql/postgreSQL
2015-09-23 11:02:17
http://dev.mysql.com/downloads/mysql
选择Source Code
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.html
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文件
[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