在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 ...
随机推荐
- 在Excel中引用其他宏
在excel的使用过程中,会用到一些自定义函数,可以使用宏轻松的实现这些功能,问题是必须使用“启用宏的excel”,这样用户每次打开时都要启用宏. 现用以按背景色计划为例,解决以上问题: 1.新建一个 ...
- java面向对象编程— —第七章 继承
7.1继承的起源 继承(Inheritance),即在面向对象编程中,可以通过扩展(extends)一个已有的类,并继承该类的属性的行为,来创建一个新的类. 已有的类称为父类(也可以称为基类,超类), ...
- "QQ尾巴病毒"核心技术的实现原理分析
声明:本文旨在探讨技术,请读者不要使用文章中的方法进行任何破坏. 2003这一年里,QQ尾巴病毒可以算是风光了一阵子.它利用IE的邮件头漏洞在QQ上疯狂传播.中毒者在给别人发信息时,病毒会自动在信息文 ...
- 启动项目报错Error: listen EADDRINUSE
我在使用elasticsearch的kibana插件时候,有一次启动,遇到这个错误: Error: listen EADDRINUSE 它的意思是,端口5601被其他进程占用. 故而,需要kill掉那 ...
- centos=>gsutil,iptables
sudo apt-get remove --purge gsutil sudo easy_install -U pip sudo pip2 install gsutil gsutil ls gs:/ ...
- Linux gcc编译(动态库,静态库)
1. linux 库路径: /lib , /usr/lib , /usr/local/lib 2.linux 编译静态库 a.编写源文件vi pr1.c void print1(){ print ...
- Oracle创建用户并给用户授权查询指定表或视图的权限
MSV31账户登录数据库进行如下操作: CREATE USER NORTHBOUND IDENTIFIED BY NORTHBOUND DEFAULT TABLESPACE "TBS_DN ...
- 教学目标的表述方式──行为目标的ABCD表述法
教学目标应规定学生在教学活动结束后能表现出什么样的学业行为,并限定学生学习过程中知识.技能的获得和情感态度发展的层次.范围.方式及变化效果的量度.对每节课教学目标的准确表述,可以充分发挥教学目标在教学 ...
- ASIHTTPRequest 在release(打包)模式下数据获取或post失败问题
ASIHTTPRequest 在relase模式下失效 表现为,调用网络请求后没有任何反应 原因之一: ARC模式下,在ASIHTTPRequest 前面会加上__weak来解决循环应用,这个__we ...
- SharePoint 2013 开发——开发并部署webpart
博客地址:http://blog.csdn.net/FoxDave webpart我们就不详细阐述了,在APP的开发中,自定义属性设置通过APP webpart的URL查询字符串传递,它通过IFR ...