CentOS 6.3下源码编译安装MySQL 5.6

发布时间:2020-11-22编辑:脚本学堂
介绍下CentOS 6.3下安装MySQL 5.6.10的方法,使用源码编译安装MySQL 5.6,有需要的朋友参考下。

linux操作系统:centos 6.3
1、下载:当前mysql版本到了5.6.10
下载地址:http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.11.tar.gz

2、安装必要软件包
 

复制代码 代码示例:
yum -y install  gcc gcc-c++ gcc-g77 autoconf automake zlib* fiex* libxml* ncurses-devel libmcrypt* libtool-ltdl-devel* make cmake

3、开始编译安装(默认情况下是安装在/usr/local/mysql )
 

复制代码 代码示例:

[root@jbxue ~]# groupadd mysql
[root@jbxue ~]# useradd -r -g mysql mysql
[root@jbxue ~]# tar -zxvf mysql-5.6.10.tar.gz
[root@jbxue ~]# cd mysql-5.6.10
[root@jbxue mysql-5.6.10]# cmake .
[root@jbxue mysql-5.6.10]# make && make install
[root@jbxue ~]# chown -R mysql.mysql /usr/local/mysql
[root@jbxue ~]# cd /usr/local/mysql/scripts
[root@jbxue ~]# ./mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
[root@jbxue ~]# cd /usr/local/mysql/support-files
[root@jbxue support-files]# cp mysql.server /etc/rc.d/init.d/mysql
[root@jbxue support-files]# cp my-default.cnf /etc/my.cnf
[root@jbxue ~]# chkconfig -add mysql
[root@jbxue ~]# chkconfig mysql on
[root@jbxue ~]# ln -s /usr/local/mysql/lib/mysql /usr/lib/mysql
[root@jbxue ~]# ln -s /usr/local/mysql/include/mysql /usr/include/mysql
[root@jbxue ~]# ln -s /usr/local/mysql/bin/mysql /usr/bin/mysql
[root@jbxue ~]# ln -s /usr/local/mysql/bin/mysqldump /usr/bin/mysqldump
[root@jbxue ~]# ln -s /usr/local/mysql/bin/myisamchk /usr/bin/myisamchk
[root@jbxue ~]# service mysql start
Starting MySQL SUCCESS!
[root@jbxue ~]# mysqladmin -u root password pwd
[root@jbxue ~]# mysql -uroot -ppwd
Welcome to the MySQL monitor.  Commands end with ; or g.
Your MySQL connection id is 1
Server version: 5.6.11 Source distribution

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.

4、开启远程连接权限
主机环境搭建之常用配置篇-Linux mysql 允许远程连接

通常,要在本地使用一些工具管理我们的数据库服务器,那么安装MySQL后,默认是不允许远程访问的,如何配置远程连接呢?
错误:
ERROR 1130: Host ’192.168.1.3′ is not allowed to connect to this MySQL server

解决方法:
 

复制代码 代码示例:
/usr/local/mysql/bin/mysql -u root -p (进入mysql)
use mysql;
select ‘host’ from user where ‘user’='root’;
update user set host = ‘%’ where ‘user’ = ‘root’;
flush privileges;

注意:在mysql 命令行形式下一定要输入”;”.