首页 > 代码库 > centos6.5下面mysql5.6的安装

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 mysqlmysql

5 到对应的目录下面

cd /usr/local/

tar zxvfmysql-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 sourcedirectory "/opt/mysql-5.7.3-m13-linux-glibc2.5-x86_64" does notappear to contain CMakeLists.txt.

把路径再确认下。

 

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

-- Running cmakeversion 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 cmakeversion 2.6.4

-- Not buildingNDB

-- Librarymysqlclient depends on OSLIBS -lpthread;m;rt;dl

Warning: Bisonexecutable not found in PATH

-- Librarymysqlserver depends on OSLIBS -lpthread;m;rt;crypt;dl

-- Configuringdone

-- Generatingdone

-- Build fileshave 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+xscripts/mysql_install_db

然后再次执行

 

出现如下提示就成功了

PLEASE REMEMBER TOSET 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 mysqlrestart

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

vim/etc/init.d/mysql 

添加pid的路径

我的是

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

 

13 设置开机启动

查看是否有mysql

chkconfig list | grepmysql 

添加mysql

chkconfig --add mysql

设置on

chkconfig --level 3mysql

 

最后remove安装包

Rm –rf/usr/local/mysql5.6.19

centos6.5下面mysql5.6的安装