一、下载

到官方网站下载mysql源码:http://dev.mysql.com/downloads/mysql/#downloads

查找到source code,下载安装包:msyql-5.6.10.tar.gz

或者wget http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.10.tar.gz

解压

tar -xvf mysql-5.6.10.tar.gz

二、安装

cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_UNIX_ADDR=/tmp/mysql.sock -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS=all -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DENABLED_LOCAL_INFILE=1 -DMYSQL_DATADIR=/var/mysql/data -DMYSQL_USER=mysql -DWITH_SSL=yes

 

make && make install

三、配置用户

groupadd mysql
useradd -g mysql mysql

四、配置mysql

chmod +w /usr/local/mysql/
chown -R mysql:mysql /usr/local/mysql/
ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /usr/lib/libmysqlclient.so.18
mkdir -p /var/mysql/
mkdir -p /var/mysql/data/
mkdir -p /var/mysql/log/
chown -R mysql:mysql /var/mysql/
cd /usr/local/mysql/support-files    
cp mysql.server /etc/rc.d/init.d/mysqld
cp my-default.cnf /var/mysql/my.cnf
/usr/local/mysql/scripts/mysql_install_db \
--defaults-file=/var/mysql/my.cnf \
--basedir=/usr/local/mysql \
--datadir=/var/mysql/data \
--user=mysql
chmod +x /etc/init.d/mysqld 
vi /etc/init.d/mysqld 
basedir=/usr/local/msyql
datadir=/var/mysql/data
/usr/local/mysql/bin/mysqld_safe --defaults-file=/var/mysql/my.cnf
/usr/local/mysql/bin/mysqladmin password '123456' 

五、加入启动项

chkconfig --add mysqld
chkconfig --level 345 mysqld on

六、启动服务

service mysqld start

七、链接

ln -s /usr/local/mysql/bin/mysql /usr/bin/mysql
ln -s /usr/local/mysql/bin/mysqldump /usr/bin/mysqldump

 

转载于:https://www.cnblogs.com/zhuangzebo/archive/2013/06/03/3115737.html

Logo

开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!

更多推荐