RHEL5.6环境下yum安装MySQL记录,2017年2月20日

1、卸载原有的MySQL

rpm -qa命令查询是否安装了MySQL

[root@localhost mysql]# rpm -qa|grep mysql
mysql-server-5.0.77-4.el5_5.4
mysql-5.0.77-4.el5_5.4

使用rpm -e命令卸载安装包,如果卸载时提示依赖可以增加“--nodeps”参数;

如果想删除依赖项则直接卸载依赖项后再删除相应的包。

[root@localhost mysql]# rpm -e mysql-server-5.0.77-4.el5_5.4
[root@localhost mysql]# rpm -e mysql-5.0.77-4.el5_5.4
error: Failed dependencies:libmysqlclient.so.15()(64bit) is needed by (installed) perl-DBD-MySQL-3.0007-2.el5.x86_64libmysqlclient.so.15(libmysqlclient_15)(64bit) is needed by (installed) perl-DBD-MySQL-3.0007-2.el5.x86_64
[root@localhost mysql]# rpm -qa|grep MySQL
perl-DBD-MySQL-3.0007-2.el5
[root@localhost mysql]# rpm -e perl-DBD-MySQL-3.0007-2.el5
[root@localhost mysql]# rpm -e mysql-5.0.77-4.el5_5.4

2、yum安装MySQL

查询yum源中是否具有MySQL服务。

[root@localhost yum.repos.d]# yum list | grep mysql
This system is not registered with RHN.
RHN support will be disabled.apr-util-mysql.x86_64                      1.2.7-11.el5_5.2            base
bytefx-data-mysql.x86_64                   1.2.4-2.el5.centos          extras
freeradius-mysql.x86_64                    1.1.3-1.6.el5               base
freeradius2-mysql.x86_64                   2.1.12-5.el5                base
libdbi-dbd-mysql.x86_64                    0.8.1a-1.2.2                base
mod_auth_mysql.x86_64                      1:3.0.0-3.2.el5_3           base
mysql.i386                                 5.0.95-5.el5_9              base
mysql.x86_64                               5.0.95-5.el5_9              base
mysql-bench.x86_64                         5.0.95-5.el5_9              base
mysql-connector-odbc.x86_64                3.51.26r1127-2.el5          base
mysql-connector-odbc64.x86_64              5.1.8-1.el5                 base
mysql-devel.i386                           5.0.95-5.el5_9              base
mysql-devel.x86_64                         5.0.95-5.el5_9              base
mysql-server.x86_64                        5.0.95-5.el5_9              base
mysql-test.x86_64                          5.0.95-5.el5_9              base
mysql51.x86_64                             1-9.el5                     base
mysql51-build.x86_64                       1-9.el5                     base
mysql51-mysql.x86_64                       5.1.70-1.el5                base
mysql51-mysql-bench.x86_64                 5.1.70-1.el5                base
mysql51-mysql-libs.x86_64                  5.1.70-1.el5                base
mysql51-mysql-server.x86_64                5.1.70-1.el5                base
mysql51-mysql-test.x86_64                  5.1.70-1.el5                base
mysql51-runtime.x86_64                     1-9.el5                     base
mysql55.x86_64                             1-12.el5                    base
mysql55-build.x86_64                       1-12.el5                    base
mysql55-mysql.x86_64                       5.5.45-1.el5                update
mysql55-mysql-bench.x86_64                 5.5.45-1.el5                update
mysql55-mysql-devel.i386                   5.5.45-1.el5                update
mysql55-mysql-devel.x86_64                 5.5.45-1.el5                update
mysql55-mysql-libs.x86_64                  5.5.45-1.el5                update
mysql55-mysql-server.x86_64                5.5.45-1.el5                update
mysql55-mysql-test.x86_64                  5.5.45-1.el5                update
mysql55-runtime.x86_64                     1-12.el5                    base
pdns-backend-mysql.x86_64                  2.9.21-4.el5.centos         extras
php-mysql.x86_64                           5.1.6-45.el5_11             update
php-pear-MDB2-Driver-mysql.noarch          1.4.1-3.el5.centos          extras
php53-mysql.x86_64                         5.3.3-26.el5_11             update
qt4-mysql.x86_64                           4.2.1-1.el5_7.1             base
rsyslog-mysql.x86_64                       3.22.1-7.el5                base
rsyslog5-mysql.x86_64                      5.8.12-7.el5_11             update
[root@localhost yum.repos.d]#

安装MySQL及其相关服务

yum install -y mysql-server mysql mysql-devel

[root@localhost yum.repos.d]# rpm -qa|grep mysql
mysql-5.0.95-5.el5_9
mysql-devel-5.0.95-5.el5_9
mysql-devel-5.0.95-5.el5_9
mysql-5.0.95-5.el5_9
mysql-server-5.0.95-5.el5_9

可以看到mysql安装的包。

3、配置MySQL

3.1、查看MySQL服务状态

[root@localhost yum.repos.d]# service mysqld status
mysqld is stopped

3.2、启动MySQL服务

[root@localhost yum.repos.d]# service mysqld start
Initializing MySQL database:  Installing MySQL system tables...
OK
Filling help tables...
OKTo start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your systemPLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h localhost.localdomain password 'new-password'Alternatively you can run:
/usr/bin/mysql_secure_installationwhich will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.See the manual for more instructions.You can start the MySQL daemon with:
cd /usr ; /usr/bin/mysqld_safe &You can test the MySQL daemon with mysql-test-run.pl
cd mysql-test ; perl mysql-test-run.plPlease report any problems with the /usr/bin/mysqlbug script!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
                                                           [  OK  ]
Starting mysqld:                                           [  OK  ]
[root@localhost yum.repos.d]#

查看MySQL服务状态:

[root@localhost yum.repos.d]# service mysqld status
mysqld (pid 5806) is running...

在终端中敲入mysql命令可以直接进入mysql命令行,此时MySQL没有设置登录密码。

[root@localhost yum.repos.d]# mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.0.95 Source distributionCopyright (c) 2000, 2011, 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>

3.3、启用MySQL登录密码:

[root@localhost yum.repos.d]# mysqladmin -u root password "passw0rd"

再次敲入mysql提示登录信息:

[root@localhost yum.repos.d]# mysql
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

使用密码登录MySQL:

[root@localhost yum.repos.d]# mysql mysql -u root -p
Enter password:
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -AWelcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.0.95 Source distributionCopyright (c) 2000, 2011, 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>

3.4、允许root账号远程登录:

mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'passw0rd' WITH GRANT OPTION;
Query OK, 0 rows affected (0.00 sec)

转载于:https://www.cnblogs.com/xusweeter/p/6422104.html

RHEL5.6环境下yum安装MySQL相关推荐

  1. yum mysql的安装目录在哪_linux下yum安装 mysql 及详细配置及修改mysql默认目录

    linux下yum安装 mysql 及详细配置及修改mysql默认目录. 一.[root@sample ~]# yum -y install mysql-server ← 安装MySQL -..略 I ...

  2. liunx 环境下docker安装mysql

    liunx 环境下docker安装mysql 1.链接虚拟机 无界面启动 vagrant ssh name(虚拟机的名) 2.虚拟机上下载mysql5.7 docker pull mysql5.7 s ...

  3. Linux下yum安装MySQL yum安装MySQL指定版本

    yum 安装MySQL 1. 检查安装情况 查看有没有安装过: yum list installed MySQL* (有存在要卸载yum remove MySQL*) rpm -qa | grep m ...

  4. 在CentOS 6.3 64bit下yum安装MySQL后重置root密码的方法

    为了简单省事,我在CentOS 6.3上直接使用yum方法来安装MySQL,安装很顺利,但是我发现root用户登录不了. 下面是参考网上的资料并实操后的笔记整理 yum -y install mysq ...

  5. centos6.4安装java,CentOS6.4下YUM安装MySQL和JDK和Tomcat

    1.检查可用的安装包 1.1.检查java安装包yum search java 显示如下: 1.2.tomcat安装包yum search tomcat 显示如下: 1.3.检查mysql安装包yum ...

  6. yum如何卸载mysql_linux下 yum 安装mysql和卸载

    1.查看有没有安装过: yum list installed mysql* rpm -qa | grep mysql* 2.查看有没有安装包: yum list mysql* 3.安装mysql客户端 ...

  7. 阿里云,CentOS下yum安装mysql,jdk,tomcat

    首先说明,服务器是阿里云的,centos6.3_64位安全加固版.首先需要登陆进来,使用的是putty,因为最初的时候,Xshell登陆会被拒绝. 0. 创建个人文件夹 [java] view pla ...

  8. centos7下yum安装mysql

    2019独角兽企业重金招聘Python工程师标准>>> 一般在linux下安装mysql 的步骤如下: 安装前看是否安装过mysql, yum list installed mysq ...

  9. Centos7下yum安装MySQL 5.7

    在CentOS中默认安装有MariaDB,这个是MySQL的分支,但为了需要,还是要在系统中安装MySQL,而且安装完成之后可以直接覆盖掉MariaDB. 1 下载并安装MySQL官方的 Yum Re ...

最新文章

  1. AssetBundle——外部加载资源Asset
  2. 首款鸿蒙p系om统终端,华为全力赋能:首款鸿蒙系统终端荣耀智慧屏,距离上市销售倒计时...
  3. 1.16 静态内部类
  4. 深入浅出的mysql第三版和第二版的区别_读《深入浅出Mysql》第二版,笔记
  5. python3.5安装pygame_安装pygame for Python3.5
  6. Taro+react开发(70):flex布局
  7. bca ac如何联合索引_BCA的完整形式是什么?
  8. 什么是大数据,大数据到底应该如何学?
  9. Grub2中文指南4---开机影像和主题
  10. 《计算机应用基础》测试题,《计算机应用基础》测试题(一)
  11. redis开发与运维笔记
  12. Ubuntu Desktop LTS - 开机数字小键盘
  13. 什么是质量功能配置(QFD)(转载)
  14. XSS 工具之 beef
  15. LMDI 理论推导详解【从理论到Python-MATLAB实现(理论)】
  16. 追风筝的人 第八章
  17. Lesson 49 At the butcher's
  18. 断点续传服务端处理(http206)
  19. 记录一次糟心的pyinstall安装经历
  20. idea重装以后打不开,双击没有反应

热门文章

  1. Java正则表达式中的捕获组的概念及相关API使用
  2. iis应用池解决方案
  3. 华为路由器防火墙配置命令总结(上)
  4. 配置WIN2003远程桌面的客户端连接数
  5. Windows Vista SP1正式版独立安装包
  6. C++ STL学习笔记(3) 分配器Allocator,OOP, GP简单介绍
  7. rda冗余分析步骤_FEMS Microbiol Ecol |微生物生态学中的多变量分析
  8. python的requests模块功能_python-Requests模块的使用
  9. Linux切换slave,热备服务器中,切换master中切换SQL
  10. soul刷屏编程代码_奔涌吧,编程!少儿编程教育在未来会像语文,数学一样重要!...