CentOS 6.3 安装mysql-5.6.13

1、

# yum install bison gcc gcc-c++ autoconf automake zlib* libxml* ncurses-devel libtool-ltdl-devel*

2、安装wget

yum install wget

3、安装cmake

# wget http://www.cmake.org/files/v2.8/cmake-2.8.6.tar.gz
# tar zxvf cmake-2.8.6.tar.gz
# cd cmake-2.8.6/
# ./configure
# gmake
# gmake install  
4、 添加MySQL用户和用户组

groupadd mysql

useradd -g mysql mysql

5、安装mysql

# tar zxvf mysql-5.6.13.tar.gz

mv mysql-5.6.13 /usr/local/

cd /usr/local/mysql-5.6.13/

cmake .

make && make install

cd /usr/local/mysql/

chown -R mysql .

chgrp -R mysql .

scripts/mysql_install_db --user=mysql

./bin/mysqld_safe --user=mysql &

报错:

mysqld_safe Logging to '/usr/local/mysql/data/localhost.localdomain.err'.
mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data

cd /usr/local/mysql/data

chgrp mysql localhost.localdomain.err 

cp ./support-files/mysql.server /etc/rc.d/init.d/mysqld

chmod 755 /etc/rc.d/init.d/mysqld

chkconfig --add mysqld

6、设置启动脚本变量
vi /etc/rc.d/init.d/mysqld

加入:

basedir=/usr/local/mysql
datadir=/usr/local/mysql/data/

7、设置变量环境

echo "PATH=$PATH:/usr/local/mysql/bin" >> /etc/profile
export PATH=$PATH:/usr/local/mysql/bin

8、启动服务
service mysqld start

9、设置数据库管理员root密码
mysqladmin -u root password '123456'
service mysqld restart

10、进入Mysql

mysql –u root –p

你可能感兴趣的:(mysql,centos)