mysql

yum -y install ncurses-devel
yum -y install gcc-c++
yum -y install cmake
yum -y install gcc

groupadd mysql
useradd -r -g mysql mysql

 

mkdir /usr/local/mysql

mkdir /usr/local/mysql/data

tar -zvxf mysql-5.6.20.tar.gz
cd /usr/local/mysql-5.6.20
cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DINSTALL_DATADIR=/usr/local/mysql/data  -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DEXTRA_CHARSETS=all -DENABLED_LOCAL_INFILE=1 && make && make install

 

重新编译时,需要清除旧的对象文件和缓存信息。
make clean
rm -f  CMakeCache.txt
rm -rf /etc/my.cnf

 


cd /usr/local/mysql
chown -R root:mysql .
chown -R mysql:mysql data

 

 


vi /root/.bash_profile
PATH=$PATH:$HOME/bin:/usr/local/mysql/bin:/usr/local/mysql/lib
source /root/.bash_profile

 


初始化数据库
   cd /usr/local/mysql/scripts/
./mysql_install_db --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data/ --user=mysql

 

注册mysql服务
   cp /usr/local/mysql/support-files/mysql.server /etc/rc.d/init.d/mysqld

   cp /usr/local/mysql/support-files/my-default.cnf /etc/my.cnf

   chkconfig --add mysqld

   chkconfig mysqld on

   service mysqld start

  

解密码
mysqld_safe --user=mysql --skip-grant-tables --skip-networking &

你可能感兴趣的:(mysql)