在centos使用rpm包的方式安装mysql,对于centos官方实际推荐使用yum进行安装,下载安装的方式主要用于内网服务器不能连接外网yum源的情况。

下载包

首先根据centos版本在mysql的官网下载rpm安装包,我的centos版本为6.6,下载的安装包为"MySQL-5.6.26-1.el6.x86_64.rpm-bundle.tar"

进行安装

  • 首先进行解压

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

  • 然后先安装历史库包

sudo rpm -i MySQL-shared-compat-5.6.26-1.el6.x86_64.rpm

  • 卸载操作系统中原有的mysql包

sudo yum remove mysql-libs

  • 安装mysql服务端,实际的数据库服务进程

rpm -i MySQL-server-5.6.26-1.el6.x86_64.rpm

  • 安装mysql客户端,用于连接数据库

sudo rpm -i MySQL-client-5.6.26-1.el6.x86_64.rpm

  • 安装之后的文件目录

/usr/bin Client programs and scripts
/usr/sbin The mysqld server
/var/lib/mysql Log files, databases
/usr/share/info MySQL manual in Info format
/usr/share/man Unix manual pages
/usr/include/mysql Include (header) files
/usr/lib/mysql Libraries
/usr/share/mysql Miscellaneous support files, including error messages, character set files, sample configuration files, SQL for database installation
/usr/share/sql-bench Benchmarks

启动使用

  • 安装过程中,会自动添加一个mysql用户和组,所以可以用这个用户或者root来启动mysql服务。

  • 使用rpm包安装默认添加了系统自动启动,可以使用service mysql stop从系统级别来停止mysql服务。

  • 一般情况下,首次登陆时可以通过空密码登陆,然后登陆数据库之后修改密码,但是我在安装完之后重启了系统,再次登陆时就不能通过空密码进行登陆了。

最后使用下面的方式更改了密码。

[root@centos1 ~]# service mysql stop
Shutting down MySQL.. SUCCESS!
[root@centos1 ~]#
[root@centos1 ~]#
[root@centos1 ~]# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
[1] 2097
[root@centos1 ~]# 151024 10:08:17 mysqld_safe Logging to '/var/lib/mysql/centos1.err'.
151024 10:08:17 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql [root@centos1 ~]# mysql -u root mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.26 MySQL Community Server (GPL) 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> update user set password=PASSWORD('root') where user='root';
Query OK, 4 rows affected (0.06 sec)
Rows matched: 4 Changed: 4 Warnings: 0 mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec) mysql> quit
Bye
[root@centos1 ~]# mysql -uroot -proot
Warning: Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.6.26 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.
  • 后面就可以创建新的用户进行登陆和使用了。

在centos使用rpm包的方式安装mysql,以及更改root密码的更多相关文章

  1. CentOS 下 rpm包与 yum 安装与卸载

    rpm包的安装:      1.安装一个包 # rpm -ivh 2.升级一个包 # rpm -Uvh 3.移走一个包 # rpm -e 4.安装参数 --force 即使覆盖属于其它包的文件也强迫安 ...

  2. 阿里云ecs Linux下安装MySQL后设置root密码 【转】

    方法一:最简单的方法,也是安装完mysql后,系统提示的方法.使用mysqladmin来完成.shell> mysqladmin -u root password "newpwd&qu ...

  3. 在Fedora 20 上安装Mysql并初始化root密码

    [root@localhost ~]# yum -y install community-mysql-server #安装数据库 已加载插件:langpacks, refresh-packagekit ...

  4. 记录下 rhel 7 安装MySQL 并重置root密码

    注意官方是很不提倡用root的. 下载并安装MySQL 最新的rpm地址 https://dev.mysql.com/downloads/repo/yum/ #wget https://repo.my ...

  5. MacOs安装mysql与修改root密码

    1.下载安装包 http://www.mysql.com/downloads/ 找到如下内容下载 mysql-5.7.21-1-macos10.13-x86_64.dmg下载地址是 https://c ...

  6. linux 配置网卡、远程拷贝文件、建立软硬链接、打包/解包、压缩/解压缩、包操作、yum配置使用、root密码忘记

    目录 一.配置网卡 二.xshell连接 三.远程拷贝文件 四.建立软硬连接 五.打包/解包和压缩/解压缩 六.包操作 七.配置yum源 配置yum源 配置阿里云源 常用命令 yum其他命令 八.重置 ...

  7. CentOS 6.5 RPM包方式安装 Mysql 5.6

    1. 下载MySQL 5.6 下载页面:http://dev.mysql.com/downloads/mysql/此处选择“Red Hat Enterprise Linux 6 / Oracle Li ...

  8. CentOS7下通过rpm方式安装MySQL及插入中文问题解决 [原创]

    一 CentOS下通过rpm方式安装MySQL CentOS版本:CentOS-7 MySQL版本:MySQL-5.6.22 在网上搜了一下,Linux下安装MYSQL有三种方式: 1) 通过yum命 ...

  9. 如何使用yum来下载RPM包而不进行安装

    如何使用yum来下载RPM包而不进行安装 2015-03-23 13:15 theo-l译 linux.cn 字号:T | T yum是基于Red Hat的系统(如CentOS.Fedora.RHEl ...

随机推荐

  1. 使用Parallel

    Parallel是.net framework为我们封装的用于并行的静态类,它使用起来简单灵活.它为我们提供了三个方法,分别是Invoke,For和ForEach.下面来进行分别演示. Paralle ...

  2. bzoj 2152: 聪聪可可

    #include<cstdio> #include<algorithm> using namespace std; ; ],head[N],son[N],f[N],d[N],r ...

  3. 3.5电子书pc显示

    使用svgalib 下载地址:https://launchpad.net/ubuntu/+source/svgalib/1:1.4.3-30svgalib_1.4.3.orig.tar.gzsvgal ...

  4. long long 读数scanf的转换 #define

    在win32的评测系统下,long long scanf 要用"%I64d" ,而网上评测和考试要用"%lld",因此,难免有点麻烦,还会runtime err ...

  5. Windows系统安装时间

    http://www.45it.com/windowszh/201206/30693.htm 修改系统安装时间 开始" - "运行" - 输入"regedit& ...

  6. Quartz2D

    http://donbe.blog.163.com/blog/static/138048021201052093633776/ 详解 代码如下: DJView 绘制线段 基本图形 // // DJVi ...

  7. win10 用微软账户登录无法访问共享的问题

    百度找了一大堆可以解决的,最终最简单的方式(可能是bug): 测试了一下,Win10用微软账户登录的,连局域网共享时,输入用户名的时候,前面加个乱七八糟的域名就可以访问了: 比如: 用户名:   ba ...

  8. 记录一些容易忘记的属性 -- NSTimer

    使定时器停止的方法: 1. //将定时器的启动时间设置为很久以后的将来,到这个时间,定时器才会开始工作            [_timer setFireDate:[NSDate distantFu ...

  9. C++学习之类的构造函数、析构函数

    在C++的类中,都会有一个或多个构造函数.一个析构函数.一个赋值运算操作符.即使我们自己定义的类中,没有显示定义它们,编译器也会声明一个默认构造函数.一个析构函数和一个赋值运算操作符.例如: //声明 ...

  10. 新发布GoldenGate 12c版本中的主要特性

        业界领先的实时数据集成工具GoldenGate现在可以帮助企业在传统数据库和云平台.大数据平台之间进行实时复制.新的OGG 12c支持更多的异构数据库和大数据平台,进一步提升可管理性和对混合云 ...