centos6.5下面mysql5.6的安装

1 本地下载,用rz操作导到/usr/local/

我的版本是mysql5.6.19

2 安装cmake yum install cmake

3 安装需要用到的二个插件

ncurses
ncurses-devel

yum install ncurses ncurses-devel

4 创建mysql需要用到的组和用户

groupadd mysql

useradd -g mysql mysql

5 到对应的目录下面

cd /usr/local/

tar zxvf mysql-5.6.19

cd mysql-5.6.19

6 cmake命令安装

cmake命令:注意:路径要对应自己的目录

cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/data/mysql -DMYSQL_UNIX_ADDR=/tmp/mysql.sock -DWITH_INNOBASE_STORAGE_ENGINE=1 -DMYSQL_TCP_PORT=3306 -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_DEBUG=0

 

如果出现

CMake Error: The source directory "/opt/mysql-5.7.3-m13-linux-glibc2.5-x86_64" does not appear to contain CMakeLists.txt.

把路径再确认下。

 

出现如下结果说明成功了。

-- Running cmake version 2.6.4

-- MySQL 5.6.19

-- Packaging as: mysql-5.6.19-Linux-x86_64

-- HAVE_VISIBILITY_HIDDEN

-- HAVE_VISIBILITY_HIDDEN

-- HAVE_VISIBILITY_HIDDEN

-- Using cmake version 2.6.4

-- Not building NDB

-- Library mysqlclient depends on OSLIBS -lpthread;m;rt;dl

Warning: Bison executable not found in PATH

-- Library mysqlserver depends on OSLIBS -lpthread;m;rt;crypt;dl

-- Configuring done

-- Generating done

-- Build files have been written to: /usr/local/mysql

 

6 make

7 make install

 

8 vim /etc/my.cnf 编辑下mysql配置文件

写入当前安装的地址

 

9 cd /usr/local/mysql

./scripts/mysql_install_db --user=mysql

遇到一个问题 这个mysql_install_db没有执行权限

chmod a+x scripts/mysql_install_db

然后再次执行

 

出现如下提示就成功了

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER ! 
To do so, start the server, then issue the following commands: 

./bin/mysqladmin -u root password ‘new-password‘ 
./bin/mysqladmin -u root -h localhost.localdomain password ‘new-password‘ 

Alternatively you can run: 

./bin/mysql_secure_installation 

which will also give you the option of removing the test 
databases and anonymous user created by default. This is 
strongly recommended for production servers. 

See the manual for more instructions. 

You can start the MySQL daemon with: 

cd . ; ./bin/mysqld_safe & 

如果报错:

查看日志

Table ‘mysql.plugin‘ doesn‘t exist

这个是找不到数据文件,原因是我当时配置数据文件的时候写错了。

解决方法:

Vim /etc/my.cnf 把配置路径写对了。

10 ../bin/mysqld_safe&

启动

 

11 把启动脚本放到/etc/init.d/mysql那 方便管理

mv support-files/mysql.server /etc/init.d/mysql

同时加上执行权限 chmod a+x /etc/init.d/mysql

 

12 service mysql restart

如果遇到报pid错,查看配置是否正确

vim /etc/init.d/mysql 

添加pid的路径

我的是

mysqld_pid_file_path=/var/run/mysqld/mysqld.pid

 

13 设置开机启动

查看是否有mysql

chkconfig list | grep mysql 

添加mysql

chkconfig --add mysql

设置on

chkconfig --level 3 mysql

 

最后remove安装包

Rm –rf /usr/local/mysql5.6.19

centos6.5下面mysql5.6的安装

上一篇:oracle 通过查询灵活插入数据 insert into ...select..


下一篇:mysql添加上log_bin步骤如下