CentOS6.5 安装mysql5.6.30

1、下载解压
由于系统会自带mysql5.1版本的数据库,需要卸载。
[[email protected] src]# yum remove -y mysql-libs
[[email protected] src]# yum remove -y mysql
[[email protected] src]# wget http://mirrors.sohu.com/mysql/MySQL-5.6/mysql-5.6.30.tar.gz
[[email protected] src]# tar -zxvf mysql-5.6.30.tar.gz
[[email protected] src]# mkdir -p /data/mysql 建立数据库存放目录
2、cmake编译过程需要安装包
cmake 编译工具和一些依赖包
[[email protected] src]# cd mysql-5.6.30
[[email protected] mysql-5.6.30]# yum install -y cmake git gcc gcc-c++ ncurses-devel bison
编译过程时间较长(约10分钟)
[[email protected] mysql-5.6.30]# cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/data/mysql -
DSYSCONFDIR=/etc -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -
DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DMYSQL_UNIX_ADDR=/tmp/mysql.sock -
DMYSQL_TCP_PORT=3306 -DENABLED_LOCAL_INFILE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DEXTRA_CHARSETS=all -
DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci
[[email protected] mysql-5.6.30]# make
[[email protected] mysql-5.6.30]# make install
3、设置账号、启动mysql
[[email protected] src]# useradd -s /sbin/nologin -M mysql 新建系统用户mysql
[[email protected] src]# chown -R mysql:mysql /data/mysql
[[email protected] src]]# cd /usr/local/mysql/
[[email protected] mysql]# ./scripts/mysql_install_db --user=mysql --datadir=/data/mysql 进行数据库初始化
出现两个ok,初始化正常。
160513 16:59:20 [Note] ./bin/mysqld (mysqld 5.5.48) starting as process 10842 ...
OK
160513 16:59:21 [Note] ./bin/mysqld (mysqld 5.5.48) starting as process 10849 ...
OK
4、拷贝编辑2个文件
[[email protected] mysql]# cp support-files/mysql.server /etc/init.d/mysqld
[[email protected] mysql]# chmod 755 /etc/init.d/mysqld
[[email protected] mysql]# vim /etc/init.d/mysqld
basedir=/usr/local/mysql
datadir=/data/mysql
5、启动服务
[[email protected] mysql]# /etc/init.d/mysqld start
Starting MySQL.. SUCCESS!
[[email protected] mysql]# netstat -lnp | grep mysql
6、登录mysql数据库
初次登录,使用以下命令:
[[email protected] mysql]# /usr/local/mysql/bin/mysql -uroot -p
为了方便期间,修改环境变量,直接使用mysql登录。
[[email protected] mysql]# PATH=$PATH:/usr/local/mysql/bin
[[email protected] mysql]# mysql
[[email protected] mysql]# echo "PATH=$PATH:/usr/local/mysql/bin" >> /etc/profile 永久添加
7、报错信息。
[[email protected] mysql]# service mysqld start
Starting MySQL........ ERROR! The server quit without updating PID file (/var/lib/mysql/shell.pid).
[[email protected] mysql]# tail /var/log/mysqld.log
2016-03-02 13:56:17 27366 [Note] InnoDB: Tablespace and datafile system tables created.
2016-03-02 13:56:17 27366 [Note] InnoDB: Waiting for purge to start
2016-03-02 13:56:17 27366 [Note] InnoDB: 5.6.28 started; log sequence number 0
2016-03-02 13:56:17 27366 [Warning] No existing UUID has been found, so we assume that this is the first time that this server
has been started. Generating a new UUID: 7ab85d71-e03b-11e5-83b5-0050569d72a6.
2016-03-02 13:56:17 27366 [Note] Server hostname (bind-address): ‘*‘; port: 3306
2016-03-02 13:56:17 27366 [Note] IPv6 is available.
2016-03-02 13:56:17 27366 [Note] - ‘::‘ resolves to ‘::‘;
2016-03-02 13:56:17 27366 [Note] Server socket created on IP: ‘::‘.
2016-03-02 13:56:17 27366 [ERROR] Fatal error: Can‘t open and lock privilege tables: Table ‘mysql.user‘ doesn‘t exist
160302 13:56:17 mysqld_safe mysqld from pid file /var/lib/mysql/shell.pid ended
解决方法,在/etc/my.cnf添加datadir、basedir路径错误
8、远程登录设置
[[email protected]_1 mysql-5.6.30]# mysqladmin -u root -p password 123456 设置本地登录密码
[[email protected]_1 mysql-5.6.30]# mysql -uroot -p123456
mysql> grant all privileges on *.* to ‘root‘@‘%‘ identified by ‘123456‘;
mysql> flush privileges;

时间: 2024-10-25 15:17:53

CentOS6.5 安装mysql5.6.30的相关文章

170503、centos6.5安装mysql5.6.30

准备:虚拟机地址:192.168.0.110 安装目录/usr/local/ 首先卸载已经安装的mysql使用命令查看rpm -qa | grep mysql卸载使用 rpm -e xxx 或者 yum remove xxx下载 mysql-5.6.30-linux-glibc2.5-x86_64.tar.gz 安装:1.解压tar包 tar -zxvf mysql-5.6.30-linux-glibc2.5-x86_64.tar.gz --解压 mv mysql-5.6.30-linux-gl

centOS6.6系统中rpm安装 MySQL-5.6.30

RPM方式安装MySQL5.6.30 a. 检查MySQL及相关RPM包,是否安装,如果有安装,则移除(rpm –e 名称) 1 [[email protected] ~]# rpm -qa | grep -i mysql 2 mysql-libs-5.1.66-2.el6_3.x86_64 3 [[email protected] ~]# yum -y remove mysql-libs* b. 下载Linux对应的RPM包,如:CentOS6.6_64对应的RPM包,如下: 1 [[emai

Linux(Red Hat 6 32位) 下安装Mysql5.6.30

1. 下载MySQL 5.6 下载页面:http://dev.mysql.com/downloads/mysql/ 此处选择"Red Hat Enterprise Linux 6 / Oracle Linux 6 (x86, 32-bit), RPM Bundle"下载,下载至/root/fuxian/目录下,下载文件名为"MySQL-5.6.30-1.el6.i686.rpm-bundle.tar" 2. 解压tar包 cd /fuxian/Downloads/

centos6.8安装mysql5.6【转】

首先先要去看看本机有没有默认的mysql, 本地默认有的,我们应先卸载,在安装新的这个逻辑. rpm -qa | grep mysql 我本机默认安装的mysql5.1.73 下一步删除 rpm -e --nodeps “要卸载的名字” rpm -e --nodeps mysql-libs-5.1.73-7.el6.x86_64 这样本机的mysql就算卸载完成,下面我们要安装新的 了. 有朋友问,为啥不用wge,用rz,其实用哪个都一样,自己习惯. 在usr/local下创建一mysql文件夹

CentOS-6.3安装Mysql-5.5.29

安装方式分为rpm和源码编译安装两种,本文是采用mysql源码编译方式,编译器使用Cmake.软件需要mysql-5.5.29.tar.gz和cmake-2.8.10.2.tar.gz,请自行下载.下载地址:http://mysql.mirror.kangaroot.net/Downloads/http://www.cmake.org/files/v2.8/cmake-2.8.10.2.tar.gz其中mysql使用最新的稳定版本,即最新试用版的上一个版本,且非rc或者alpha的版本,Cmak

CentOS6.5安装MySQL5.7

CentOS6.5安装MySQL5.7以hadoop用户登录系统,1.检测系统是否已经安装过mysql或其依赖,若已装过要先将其删除,否则第4步使用yum安装时会报错: #查看mysql是否安装,如果已经安装需要卸载,如果是 sudo rpm -qa|grep mysql 2.如果存在mysql,依次卸载 sudo yum -y remove mysql-community-server-5.7.23-1.el6.x86_64 sudo yum -y remove mysql-community

Centos6.5安装MySQL5.6备忘记录

Centos6.5安装MySQL5.6 1. 查看系统状态 [root@itzhouq32 tools]# cat /etc/issue CentOS release 6.5 (Final) Kernel \r on an \m [root@itzhouq32 tools]# uname -a Linux itzhouq32 2.6.32-431.el6.x86_64 #1 SMP Fri Nov 22 03:15:09 UTC 2013 x86_64 x86_64 x86_64 GNU/Lin

centos6.5下安装mysql5.6.30

1.解压mysql tar -xf mysql-5.6.30-linux-glibc2.5-x86_64.tar.gz  -C /usr/local mv mysql-5.6.30-linux-glibc2.5-x86_64 mysql-5.6.30 2.添加用户与组 groupadd mysql useradd -g mysql mysql  -s /sbin/nologin  chown -R mysql:mysql mysql-5.6.30 3.安装数据库 mkdir /usr/local

CentOS6.5安装MySQL5.1.73数据库

一.描述 本博客主要介绍CentOS6.5安装MySQL数据库 .启动和关闭MySQL服务.MySQL的登录和退出,以及My SQL数据库root用户的密码配置和修改. 二.主要步骤 1.查看本系统是否已经安装有MySQL数据库 先查看本操作系统是否已经安装有操作系统,显示只有一个mysql的类库,并没有安装该数据库. [[email protected] tongSoftware]$ rpm -qa | grep mysql mysql-libs-5.1.73-3.el6_5.x86_64 2