在centos使用rpm包的方式安装mysql,以及更改root密码
在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密码的更多相关文章
- CentOS 下 rpm包与 yum 安装与卸载
rpm包的安装: 1.安装一个包 # rpm -ivh 2.升级一个包 # rpm -Uvh 3.移走一个包 # rpm -e 4.安装参数 --force 即使覆盖属于其它包的文件也强迫安 ...
- 阿里云ecs Linux下安装MySQL后设置root密码 【转】
方法一:最简单的方法,也是安装完mysql后,系统提示的方法.使用mysqladmin来完成.shell> mysqladmin -u root password "newpwd&qu ...
- 在Fedora 20 上安装Mysql并初始化root密码
[root@localhost ~]# yum -y install community-mysql-server #安装数据库 已加载插件:langpacks, refresh-packagekit ...
- 记录下 rhel 7 安装MySQL 并重置root密码
注意官方是很不提倡用root的. 下载并安装MySQL 最新的rpm地址 https://dev.mysql.com/downloads/repo/yum/ #wget https://repo.my ...
- MacOs安装mysql与修改root密码
1.下载安装包 http://www.mysql.com/downloads/ 找到如下内容下载 mysql-5.7.21-1-macos10.13-x86_64.dmg下载地址是 https://c ...
- linux 配置网卡、远程拷贝文件、建立软硬链接、打包/解包、压缩/解压缩、包操作、yum配置使用、root密码忘记
目录 一.配置网卡 二.xshell连接 三.远程拷贝文件 四.建立软硬连接 五.打包/解包和压缩/解压缩 六.包操作 七.配置yum源 配置yum源 配置阿里云源 常用命令 yum其他命令 八.重置 ...
- CentOS 6.5 RPM包方式安装 Mysql 5.6
1. 下载MySQL 5.6 下载页面:http://dev.mysql.com/downloads/mysql/此处选择“Red Hat Enterprise Linux 6 / Oracle Li ...
- CentOS7下通过rpm方式安装MySQL及插入中文问题解决 [原创]
一 CentOS下通过rpm方式安装MySQL CentOS版本:CentOS-7 MySQL版本:MySQL-5.6.22 在网上搜了一下,Linux下安装MYSQL有三种方式: 1) 通过yum命 ...
- 如何使用yum来下载RPM包而不进行安装
如何使用yum来下载RPM包而不进行安装 2015-03-23 13:15 theo-l译 linux.cn 字号:T | T yum是基于Red Hat的系统(如CentOS.Fedora.RHEl ...
随机推荐
- groupadd命令详解(实例)
groupadd命令详解(实例) 1.作用groupadd命令用于将新组加入系统. 2.格式groupadd [-g gid] [-o]] [-r] [-f] groupname 3.主要参数-g ...
- CSS 水平居中
一.水平居中:行内元素解决方案 居中元素:文字.链接以及其它行内元素(inline或inline-*类型的元素,如inline-block,inline-table,inline-flex)解决方案: ...
- Android TextView文字横向自动滚动(跑马灯)
TextView实现文字滚动需要以下几个要点: 1.文字长度长于可显示范围:android:singleLine="true" 2.设置可滚到,或显示样式:android: ...
- OpenCV之响应鼠标(三):响应鼠标信息
转自:http://blog.csdn.net/haihong84/article/details/6599838 程序代碼如下: #include <cv.h>#include < ...
- [C/C++]C++声明
[注]本文是Declarations的翻译和注解版. https://msdn.microsoft.com/en-us/library/f432x8c6.aspx 1.声明: 我们通过声明往C++程序 ...
- SVG 2D入门5 - 颜色的表示
SVG和canvas中是一样的,都是使用标准的HTML/CSS中的颜色表示方法,这些颜色都可以用于fill和stroke属性.基本有下面这些定义颜色的方式:1. 颜色名字: 直接使用颜色名字red, ...
- 2016 - 1 - 20 runloop学习(2)
一:CFRunLoopModeRef 1. CFRunLoopModeRef带表RunLoop的运行模式 2. 一个Runloop可以有若干个mode,每个mode又包含若干个sourse,timer ...
- (spring-第1回【IoC基础篇】)Spring容器中Bean的生命周期
日出日落,春去秋来,花随流水,北雁南飞,世间万物皆有生死轮回.从调用XML中的Bean配置信息,到应用到具体实例中,再到销毁,Bean也有属于它的生命周期. 人类大脑对图像的认知能力永远高于文字,因此 ...
- GeekPwn2015胸卡ESP8266 12E串口调试
相信今年参加GeekPwn活动的很多同学都获得了一枚GeekPwn的胸牌,为方便大家对胸牌进行一些调试和破解,这里分享一些关于这枚胸牌的一些信息 :)如发现文章之中有错误之处,欢迎大家斧正! 0×00 ...
- UIkit框架之UIimageview
1.继承链:UIview:UIresponder:NSObject 2.如果你想利用这个类来制作动态图片,你需要遵守以下的原则: (1)所有的图片的大小都要一样 (2)所有的图片要使用同样的比例,同样 ...