1)查看CentOS自带的mysql

输入 rpm -qa | grep mysql

mysql-libs-5.1.71-1.el6.x86_64

2)将其自带的mysql版本全部卸载(非常重要,如不卸载,后面会产生冲突)

rpm -e --nodeps (mysql版本号,就是上面检查到的mysql-libs-5.1.71-1.el6.x86_64)

或者用这条命令卸载,yum -y remove mysql-libs*

3)检查是否将自带的mysql版本卸载了

rpm -qa | grep mysql

4)创建mysql的存放目录(我保存在/usr/local/mysql目录下,可以根据自己的喜好创建mysql的保存路径)

mkdir /usr/local/mysql

进入到mysql目录下

cd /usr/local/mysql

5)上传mysql到 /usr/local/mysql/ 目录下

上传到 /usr/local/mysql/ 目录后查看

ls

MySQL-5.6.41-1.el6.x86_64.rpm-bundle.tar

6)安装

先解压上传的tar包

tar -xvf MySQL-5.6.41-1.el6.x86_64.rpm-bundle.tar

解压后会得到以下rpm安装文件:

MySQL-client-5.6.41-1.el6.x86_64.rpm

MySQL-devel-5.6.41-1.el6.x86_64.rpm

MySQL-embedded-5.6.41-1.el6.x86_64.rpm

MySQL-server-5.6.41-1.el6.x86_64.rpm

MySQL-shared-5.6.41-1.el6.x86_64.rpm

MySQL-shared-compat-5.6.41-1.el6.x86_64.rpm

MySQL-test-5.6.41-1.el6.x86_64.rpm

安装服务端(注意:服务端和客户端都要安装,否则会出错)

rpm -ivh MySQL-server-5.6.41-1.el6.x86_64.rpm

出现报错:

warning: MySQL-server-5.6.41-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY

error: Failed dependencies:

libaio.so.1()(64bit) is needed by MySQL-server-5.6.41-1.el6.x86_64

libaio.so.1(LIBAIO_0.1)(64bit) is needed by MySQL-server-5.6.41-1.el6.x86_64

libaio.so.1(LIBAIO_0.4)(64bit) is needed by MySQL-server-5.6.41-1.el6.x86_64

libnuma.so.1()(64bit) is needed by MySQL-server-5.6.41-1.el6.x86_64

libnuma.so.1(libnuma_1.1)(64bit) is needed by MySQL-server-5.6.41-1.el6.x86_64

libnuma.so.1(libnuma_1.2)(64bit) is needed by MySQL-server-5.6.41-1.el6.x86_64

7)安装所需要的依赖,分别执行以下命令

解决缺少perl的依赖:

yum install -y perl

解决缺少libaio.so.1(64bit)的依赖:

这里使用yum install –y libaio.so.1后发现并不能解决问题,原因yum安装的并非x86_64版本,而是i686版本

rpm -qa | grep libaio

libaio-0.3.107-10.el6.i686

手动下载libaio-0.3.107-10.el6.x86_64.rpm,下载地址如下:

上传后安装

rpm -ivh libaio-0.3.107-10.el6.x86_64.rpm

解决缺少libnuma.so.1(64bit)依赖:

yum install -y numactl

再次安装执行:

rpm -ivh MySQL-server-5.6.41-1.el6.x86_64.rpm

。。。省略。。。

A RANDOM PASSWORD HAS BEEN SET FOR THE MySQL root USER !

You will find that password in '/root/.mysql_secret'.

You must change that password on your first connect,

no other statement but 'SET PASSWORD' will be accepted.

See the manual for the semantics of the 'password expired' flag.

Also, the account for the anonymous user has been removed.

In addition, you can run:

/usr/bin/mysql_secure_installation

which will also give you the option of removing the test database.

This is strongly recommended for production servers.

See the manual for more instructions.

Please report any problems at http://bugs.mysql.com/

The latest information about MySQL is available on the web at

http://www.mysql.com

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用户设置了随机密码,可以在 /root/.mysql_secret 文件中找到,并且移除了匿名用户,可以运行 /usr/bin/mysql_secure_installation 命令来移除自带的测试数据库,还生成了默认配置文件 /usr/my.cnf

8)安装客户端

rpm -ivh MySQL-client-5.6.41-1.el6.x86_64.rpm

rpm -ivh MySQL-devel-5.6.41-1.el6.x86_64.rpm

9)检查是否安装成功(注意MySQL字母的大小写)

rpm -qa | grep MySQL

MySQL-server-5.6.41-1.el6.x86_64

MySQL-devel-5.6.41-1.el6.x86_64

MySQL-client-5.6.41-1.el6.x86_64

10)启动mysql服务器

service mysql start

出现以下提示说明安装成功!

Starting MySQL.Logging to '/var/lib/mysql/freeradius.err'.

. SUCCESS!

11)查看默认生成的随机密码(最后冒号后面的就是密码)

cat /root/.mysql_secret

# The random password set for the root user at Sun Sep 23 07:38:04 2018 (local time): psUGhQBPUZT_LPon

12)登陆mysql(输入上一步找到的密码)

mysql -u root -p

13)修改mysql登陆密码

mysql> set password=password('密码');

14)启动mysql

service mysql start

15)将mysql加到系统服务中并设置开机启动

加入到系统服务:chkconfig --add mysql

开机自动启动:chkconfig mysql on

16)开启mysql的远程登录

默认情况下mysql为安全起见,不支持远程登录mysql,所以需要设置开启  远程登录mysql的权限

登录mysql后输入如下命令:

mysql -u root -p

mysql> grant all privileges on *.* to 'root' @'%' identified by '密码';

mysql> flush privileges;

17)开放Linux的对外访问的端口3306

mysql默认没有开启对外访问端口3306,需要手动开启

/sbin/iptables

-I INPUT -p tcp --dport 3306 -j ACCEPT

/etc/rc.d/init.d/iptables save     # 将修改永久保存到防火墙中

18)初始设置mysql数据库,设置root密码,出于安全考虑,可以考虑删除匿名用户和测试数据库以及禁用远程根登录,参见下面的示例配置。

运行 /usr/bin/mysql_secure_installation 命令

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL

SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!

In order to log into MySQL to secure it, we'll need the current

password for the root user. If you've just installed MySQL, and

you haven't set the root password yet, the password will be blank,

so you should just press enter here.

Enter current password for root (enter for none):

OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MySQL

root user without the proper authorisation.

Set root password? [Y/n] n

... skipping.

By default, a MySQL installation has an anonymous user, allowing anyone

to log into MySQL without having to have a user account created for

them. This is intended only for testing, and to make the installation

go a bit smoother. You should remove them before moving into a

production environment.

Remove anonymous users? [Y/n] y

... Success!

Normally, root should only be allowed to connect from 'localhost'. This

ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] n

... skipping.

By default, MySQL comes with a database named 'test' that anyone can

access. This is also intended only for testing, and should be removed

before moving into a production environment.

Remove test database and access to it? [Y/n] y

- Dropping test database...

... Success!

- Removing privileges on test database...

... Success!

Reloading the privilege tables will ensure that all changes made so far

will take effect immediately.

Reload privilege tables now? [Y/n] y

... Success!

All done! If you've completed all of the above steps, your MySQL

installation should now be secure.

Thanks for using MySQL!

Cleaning up...

19)修改配置文件位置并做相关设置

cp /usr/share/mysql/my-default.cnf /etc/my.cnf

vi /etc/my.cnf

# 做如下配置

[client]

port = 3306

default-character-set=utf8

[mysqld]

port = 3306

character_set_server=utf8

character_set_client=utf8

collation-server=utf8_general_ci

log_error = /var/log/mysql/error.log

# 错误日志路径自己定义,前提是目录必须存在

lower_case_table_names=1

# 注意 linux下mysql安装完后是默认:表名区分大小写,列名不区分大小写; 0:区分大小写,1:不区分大小写

max_connections=1000

# 设置最大连接数,默认为 151,MySQL服务器允许的最大连接数16384

[mysql]

default-character-set = utf8

几个重要目录

数据库目录

/var/lib/mysql/

配置文件

/usr/share/mysql(mysql.server命令及配置文件)

相关命令

/usr/bin(mysqladmin mysqldump等命令)

启动脚本

/etc/rc.d/init.d/(启动脚本文件mysql的目录)

centos6卸载mysql服务器_CentOS6.5下卸载自带的MySQL数据库安装MySQL5.6相关推荐

  1. centos6.5 mysql登陆_centos6.5下mysql无法登陆的问题

    在操作mysql是可能会出现无法登陆的问题,其中最常见的错误就是,ERROR 1045,如图所示的错误: 这种错误产生的原因有两种:1.密码错误:2.用户名不正确.网上给出的方法一般是进入安全模式,修 ...

  2. mysql 手动配置服务器_Win7系统下手动配置Apache+PHP+MySQL环境WEB服务器 -电脑资料...

    本来想学学php,于是就想搭建web服务器和sql环境,结果浪费掉了不少时间, 大致的总结下,也算是长个记性. 使用的安装包分别是httpd-2.2.22-win32-x86-no_ssl .msi, ...

  3. linux程序卸载失败怎么办,在Deepin下卸载LibreOffice等软件的方法,附卸载失败的原因...

    其实在深度Deepin系统下卸载一个软件非常的简单,比如卸载LibreOffice,可以在开始菜单中找到应用图标,在它上面右键,选择卸载.如果卸载失败,多是因为依赖等问题. 卸载方法 如下图所示,找到 ...

  4. mysql企业实战_实战MySQL服务器企业技术 实战进阶学习篇 企业级MySQL实战进阶视频教程...

    ├<2-30-tomcat环境安装管理及使用tomcat链接MySQL> │  ├2-30-1-tomcat环境介绍及部署安装.mp4 │  ├2-30-2-tomcat配置管理及配置虚拟 ...

  5. shel脚本mysql锁表_centos下shell脚本kill掉mysql锁表进程【笔记】

    前几天发现服务器上的mysql出现锁表了,show processlist后发现好多都是因为写进session才锁表的,看到这个想起了会不会是硬盘空间不够了,马上查看了服务器硬盘空间,发现都100%了 ...

  6. 服务中添加mysql服务_Windows平台下在服务中添加MySQL

    widows下查看服务 1.桌面计算机-->右键-->管理-->计算机管理(本地)--->服务和应用程序-->服务 2.运行 中输入 services.msc 在服务中添 ...

  7. 怎样在dos窗口中启动mysql服务器_如何在dos命令中启动mysql或sql server 服务器的一些操作...

    ========================dos命令启动mysql或者sql srever 的步骤================= 一.dos命令启动mysql 1.进入dos命令窗口 2.启 ...

  8. 做mysql服务器 需要什么配置最好_最佳的MySQL服务器配置以获得性能?

    我们有一个使用MyIsam表运行MySQL 5.0.45的大小为150 GB的数据库,有一些大表的大小超过5 GB,索引为2GB. 服务器配置为: 8GB 双核3.2GHz –启用超线程 一次突袭5- ...

  9. linux下的常用命令 + 环境配置 + 数据库安装 一步到位!

    文章目录 一.引言 1.1 开发环境(dev) 1.2 测试环境(test) 1.3 生产环境(prod) 1.4 操作系统的选择 二.Linux介绍 2.1 Linux介绍 2.2 Linux的版本 ...

最新文章

  1. 什么是 SAP UI5 的 Element binding
  2. 在信用健全的今天,史玉柱背负2.5亿债务还能翻身吗?
  3. mysql创建表格1warning_MySQL:创建、修改和删除表
  4. 乒乓球(洛谷-P1042)
  5. wxpython开发教程_wxpython入门第十步(应用程序框架)
  6. 通过python切换hosts文件
  7. 【渝粤教育】国家开放大学2018年春季 8618-21T燃气行业规范 参考试题
  8. 苹果mac图片处理软件 :Photoshop
  9. 算法设计与分析基础(第3版)
  10. c语言坐标反算方位角函数,反三角函数/简易正反算or方位角转度分秒
  11. 又现信息泄露事 融云通讯安全守护之道
  12. Google服务和软件大全
  13. 2018.4.1(python) 请编写程序将用户输入华氏度转换为摄氏度,或将输入的摄氏度转换为华氏度。 //(米和英寸之间的长度转换)//热量转换
  14. CodeBlocks中文汉化Code::Blocks 10.05 中文版
  15. windows下discus的搭建
  16. php 实现查询百度排名,查询百度关键词排名代码 php
  17. Redhat防火墙端口设置
  18. 三十四、进阶之获取详情页面信息并显示
  19. 不可忽视的软件测试环境问题
  20. 安全模式里一键删除360卫士、杀毒、安全浏览器、压缩

热门文章

  1. NLP进阶之(七)膨胀卷积神经网络
  2. 深入浅出Redis五种基本数据类型
  3. 计图(Jittor) 1.1版本:新增骨干网络、JIT功能升级、支持多卡训练
  4. 2022-2028年中国消防车行业市场前瞻与投资战略规划分析报告
  5. 机器学习中的标量、向量、矩阵、和张量的概念
  6. MySQL 学习笔记(13)— 创建表、修改表、删除表、清空表
  7. Python 关键字 global、nonlocal、yield用法
  8. Linux下Tomcat的安装配置
  9. 解决Apache CXF 不支持传递java.sql.Timestamp和java.util.HashMap类型问题
  10. UVa12096.The SetStack Computer