CentOS 6 下RPM方式安装MySQL5.6

1. 下载Linux对应的RPM包,如:CentOS6.7_64对应的RPM包,如下:
[root@mysql ~]# ll
总用量 113808
-rw-------. 1 root root 1434 12月 13 18:47 anaconda-ks.cfg
-rw-r--r--. 1 root root 42556 12月 13 18:47 install.log
-rw-r--r--. 1 root root 10033 12月 13 18:45 install.log.syslog
-rw-r--r--. 1 root root 23135399 12月 13 18:56 MySQL-client-5.6.25-1.linux_glibc2.5.x86_64.rpm
-rw-r--r--. 1 root root 4586217 12月 13 18:56 MySQL-devel-5.6.25-1.linux_glibc2.5.x86_64.rpm
-rw-r--r--. 1 root root 88715219 12月 13 18:56 MySQL-server-5.6.25-1.linux_glibc2.5.x86_64.rpm

2. 检查MySQL及相关RPM包,是否安装,如果有安装,则移除(rpm –e 名称)
[root@mysql ~]# rpm -qa | grep -i mysql
mysql-libs-5.1.73-5.el6_6.x86_64
[root@mysql ~]# yum -y remove mysql-libs*
已加载插件:fastestmirror, refresh-packagekit, security
设置移除进程
解决依赖关系
。。。。。
完毕!

3. 安装MySQL
[root@mysql ~]# rpm -ivh MySQL-server-5.6.25-1.linux_glibc2.5.x86_64.rpm
Preparing... ########################################### [100%]
1:MySQL-server ########################################### [100%]
warning: user mysql does not exist - using root
warning: group mysql does not exist - using root
Support MySQL by buying support/licenses at http://shop.mysql.com

New default config file was created as /usr/my.cnf and
will be used by default by the server when you start it.
You may edit this file to change server settings

[root@mysql ~]# rpm -ivh MySQL-devel-5.6.25-1.linux_glibc2.5.x86_64.rpm
Preparing... ########################################### [100%]
1:MySQL-devel ########################################### [100%]
[root@mysql ~]# rpm -ivh MySQL-client-5.6.25-1.linux_glibc2.5.x86_64.rpm
Preparing... ########################################### [100%]
1:MySQL-client ########################################### [100%]

4. 初始化MySQL及设置密码
[root@mysql ~]# /usr/bin/mysql_install_db -- mysql_install_db脚本来生成帐户和相应权限许可表
WARNING: The host 'mysql' could not be looked up with /usr/bin/resolveip.
This probably means that your libc libraries are not 100 % compatible
。。省略输出。。
WARNING: Default config file /etc/my.cnf exists on the system
This file will be read by default by the MySQL server
If you do not want to use this, either remove it, or use the
--defaults-file argument to mysqld_safe when starting the server
[root@mysql ~]# service mysql start
Starting MySQL. SUCCESS!
[root@mysql ~]# cat /root/.mysql_secret --查看root账号密码
# The random password set for the root user at Tue Dec 13 18:59:06 2016 (local time): 7MhtyX3aZEl9OUf8
[root@mysql ~]# mysql -uroot -p
Enter password: --(此处复制粘贴 7MhtyX3aZEl9OUf8)
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.6.25

Copyright (c) 2000, 2015, 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.
说明: 出现mysql> 表示一切顺利成功。
mysql> SET PASSWORD = PASSWORD('123456'); --设置密码为123456

5. 允许远程登陆
mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> select host,user,password from user;
+-----------+------+-------------------------------------------+
| host | user | password |
+-----------+------+-------------------------------------------+
| localhost | root | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 |
| mysql | root | *6D95CDA252C85345E8BC1C4168E962D3949C30F9 |
| 127.0.0.1 | root | *6D95CDA252C85345E8BC1C4168E962D3949C30F9 |
| ::1 | root | *6D95CDA252C85345E8BC1C4168E962D3949C30F9 |
+-----------+------+-------------------------------------------+
4 rows in set (0.00 sec)
mysql> update user set password=password('123456') where user='root';
Query OK, 3 rows affected (0.00 sec)
Rows matched: 4 Changed: 3 Warnings: 0
mysql> update user set host='%' where user='root' and host='localhost';
Query OK, 1 row affected (0.01 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> exit

6. 设置开机自启动
[root@mysql ~]# chkconfig mysql on
[root@mysql ~]# chkconfig --list | grep mysql
mysql 0:关闭 1:关闭 2:启用 3:启用 4:启用 5:启用 6:关闭

7. MySQL的默认安装位置
/var/lib/mysql/ #数据库目录
/usr/share/mysql #配置文件目录
/usr/bin #相关命令目录
/etc/init.d/mysql #启动脚本

8. 更改MySQL目录与字符集

[root@mysql ~]# cd /home --home目录下建立data目录
[root@mysql home]# mkdir data
[root@mysql ~]# service mysql stop --把MySQL服务进程停掉
Shutting down MySQL.. SUCCESS!
[root@mysql home]# mv /var/lib/mysql /home/data --把/var/lib/mysql整个目录移到/home/data

如果/etc/目录下没有my.cnf配置文件,请到/usr/share/mysql/下找到*.cnf文件,拷贝其中一个到/etc/并改名为my.cnf)中
[root@mysql ~]# cp /usr/share/mysql/my-default.cnf /etc/my.cnf --修改配置文件位置

配置/etc/my.cnf文件,修改数据存放路径、mysql.sock路径以及默认编码utf-8.
[client]
password = 123456
port = 3306
default-character-set=utf8
[mysqld]
port = 3306
socket  = /home/data/mysql/mysql.sock
character_set_server=utf8
character_set_client=utf8
collation-server=utf8_general_ci
#(注意linux下mysql安装完后是默认:表名区分大小写,列名不区分大小写; 0:区分大小写,1:不区分大小写)
lower_case_table_names=1
#(设置最大连接数,默认为 151,MySQL服务器允许的最大连接数16384; )
max_connections=1000
[mysql]
default-character-set = utf8
socket  = /home/data/mysql/mysql.sock

查看字符集
show variables like '%collation%';
show variables like '%char%';

9. 修改MySQL启动脚本/etc/rc.d/init.d/mysql

最后,需要修改MySQL启动脚本/etc/rc.d/init.d/mysql,把其中datadir=/var/lib/mysql一行中,等号右边的路径改成你现在的实际存放路径:home/data/mysql。
[root@test1 etc]# vi /etc/rc.d/init.d/mysql
#datadir=/var/lib/mysql    (注释此行)
datadir=/home/data/mysql   (加上此行)

10. 重新启动MySQL服务
[root@mysql ~]# service mysql restart
Shutting down MySQL.. SUCCESS!
Starting MySQL. SUCCESS!
OK 一切成功

CentOS 6 下RPM方式安装MySQL5.6的更多相关文章

  1. CentOS下RPM方式安装MySQL5.6(转载)

    之前的项目全都在windows系统环境下部署的,这次尝试在Linux系统环境下部署,于是这次我们组织在7台主机上安装了JDK.Maven.Jboss其中一台安装了Mysql,并将局域网配置好,终于大功 ...

  2. CentOS6.8 下RPM方式安装MySQL5.6

    1. 检查MySQL及相关RPM包,是否安装,如果有安装,则移除(rpm –e 名称) yum remove mysql mysql-server mysql-libs(我用的上面的)或者 [root ...

  3. CentOS6.5下RPM方式安装mysql5.6.33

    1.mysql下载 下载地址:https://dev.mysql.com/downloads/mysql/5.6.html下载以下安装包: MySQL-client-5.6.33-1.el6.x86_ ...

  4. RPM方式安装MySQL5.6和windows下安装mysql解压版

    下载地址: http://cdn.MySQL.com/archives/mysql-5.6/MySQL-server-5.6.13-1.el6.x86_64.rpmhttp://cdn.mysql.c ...

  5. CentOS 使用RPM方式安装MySQL5.6

    转载自:http://blog.csdn.net/liumm0000/article/details/18841197 RPM方式安装MySQL5.6 a. 检查MySQL及相关RPM包,是否安装,如 ...

  6. RPM方式安装MySQL5.6

    原文转自:http://blog.csdn.net/liumm0000/article/details/18841197 未整理! RPM方式安装MySQL5.6 a. 检查MySQL及相关RPM包, ...

  7. centeOS6.5 RPM方式安装MySQL5.6

    RPM方式安装MySQL5.6 a. 检查MySQL及相关RPM包,是否安装,如果有安装,则移除(rpm –e 名称) 1 [root@localhost ~]# rpm -qa | grep -i ...

  8. centos7和centos6.5环境rpm方式安装mysql5.7和mysql5.6详解

    centos环境安装mysql5.7 其实不建议安装mysql5.7 语法和配置可能和以前的版本区别较大,多坑,慎入 1.yum方式安装(不推荐) a.安装mysql5.7 yum源 centos6: ...

  9. 关于centos7中使用rpm方式安装mysql5.7版本后无法使用root登录的问题

    最近在centos7中通过rpm方式安装了最新版本的mysql-server 5.7 (mysql57-community-release-el7-7.noarch.rpm) ,发现安装成功后无法使用 ...

随机推荐

  1. linux基础命令(二)用户管理和权限管理

  2. JSOI球形空间产生器 (高斯消元)

    按照朴素的列方程,可以列出n+1个n元2次方程. 将相邻的两个方程相减就可以得到n个n元1次方程,进行高斯消元就可以了. ..,..] of extended; temp,ans:..] of ext ...

  3. BS模式的模型结构详解

    编号:1004时间:2016年4月12日16:59:17功能:BS模式的模型结构详解 URL:http://blog.csdn.net/icerock2000/article/details/4000 ...

  4. js取配置文件内容

    使用 jQuery.i18n.properties 实现 Web 前端的国际化 http://www.ibm.com/developerworks/cn/web/1305_hezj_jqueryi18 ...

  5. Linux--/tmp目录文件重启后自动删除

    源博客 http://blog.itpub.net/24996904/viewspace-769327/ 在/etc/default/目录下有个rcS文件,文件内容如下:## /etc/default ...

  6. ABySS 拼接工具

    ABySS, that stands for Assembly By Short Sequences, is a de novo, parallel, paired-end sequence asse ...

  7. SecureCRT最佳配色方法+直接修改默认配置方法 - imsoft.cnblogs

    SecureCRT默认显示效果是黑白且刺眼的主题,看起来很不舒服.经过一番搜索,总结结果如下,直接设置默认属性,设置一次,不需再改. 效果图: 具体操作方法: Options->Global O ...

  8. hdu 3666 Making the Grade

    题目大意 给出了一列数,要求通过修改某些值,使得最终这列数变成有序的序列,非增或者非减的,求最小的修改量. 分析 首先我们会发现,最终修改后,或者和前一个数字一样,或者和后一个数字一样,这样才能修改量 ...

  9. iOS学习笔记---c语言第十天

    动态内存分配 一.存储区划分 从低到高(内存地址小----内存地址大)  :  代码区---常量区---静态区---堆区---栈区 栈内存 //凡是在函数体内定义的变量 都存储在栈区(包括形参). ; ...

  10. Y_TEXT001-(保存长文本)

    DATA: gs_header TYPE thead .DATA: gt_ltxts TYPE STANDARD TABLE OF tline .DATA: lw_ltxt TYPE tline . ...