Linux环境下卸载原有MySQL5.1数据库,并重新安装MySQL数据库的示例记录。

一、卸载MySQL

查看主机中是否安装了MySQL数据库:

[root@RD-viPORTAL-1 ~]# rpm -qa|grepmysql

mysql-5.1.73-5.el6_6.x86_64

mysql-devel-5.1.73-5.el6_6.x86_64

mysql-libs-5.1.73-5.el6_6.x86_64

然后通过rpm -e命令进行软件包的卸载;

[root@RD-viPORTAL-1 ~]# rpm -e mysql-5.1.73-5.el6_6.x86_64

error: Failed dependencies:

mysql= 5.1.73-5.el6_6 is needed by (installed) mysql-devel-5.1.73-5.el6_6.x86_64

发现软件包有依赖关系,百度发现可以使用“--nodeps”参数进行卸载。

[root@RD-viPORTAL-1 ~]# rpm -e mysql-5.1.73-5.el6_6.x86_64 --nodeps

[root@RD-viPORTAL-1 ~]# rpm -e mysql-devel-5.1.73-5.el6_6.x86_64 --nodeps

[root@RD-viPORTAL-1 ~]# rpm -e mysql-libs-5.1.73-5.el6_6.x86_64 --nodeps

再次查询MySQL的软件包,发现已经没有相关的rpm包了。

[root@RD-viPORTAL-1 ~]# rpm -qa|grepmysql

[root@RD-viPORTAL-1 ~]#

二、安装MySQL

安装MySQL一般需要如下rpm包。

[root@RD-viPORTAL-1mysql]# ll

总用量11788

-rw-r--r-- 1 root root 915088 2月 15 05:27 mysql-5.1.73-5.el6_6.x86_64.rpm-rw-r--r-- 1 root root 131900 2月 15 05:27 mysql-devel-5.1.73-5.el6_6.x86_64.rpm-rw-r--r-- 1 root root 1282760 2月 15 05:27 mysql-libs-5.1.73-5.el6_6.x86_64.rpm-rw-r--r-- 1 root root 9033560 2月 15 05:27 mysql-server-5.1.73-5.el6_6.x86_64.rpm-rw-r--r-- 1 root root 136464 2月 15 05:32 perl-DBD-MySQL-4.013-3.el6.x86_64.rpm

安装顺序:

perl-DBD-MySQL-4.013-3.el6.x86_64.rpm

mysql-libs-5.1.73-5.el6_6.x86_64.rpm

mysql-5.1.73-5.el6_6.x86_64.rpm

mysql-server-5.1.73-5.el6_6.x86_64.rpm

mysql-devel-5.1.73-5.el6_6.x86_64.rpm

安装过程:

使用“rpm -ivh”命令安装rpm包。

[root@RD-viPORTAL-1 mysql]# rpm -ivh mysql-libs-5.1.73-5.el6_6.x86_64.rpm

Preparing...                ########################################### [100%]

1:mysql-libs             ########################################### [100%][root@RD-viPORTAL-1 mysql]# rpm -ivh mysql-5.1.73-5.el6_6.x86_64.rpm

Preparing... ########################################### [100%]1:mysql ########################################### [100%]

[root@RD-viPORTAL-1mysql]#

[root@RD-viPORTAL-1 mysql]# rpm -ivh mysql-server-5.1.73-5.el6_6.x86_64.rpm

Preparing... ########################################### [100%]1:mysql-server ########################################### [100%]

[root@RD-viPORTAL-1mysql]#

[root@RD-viPORTAL-1 mysql]# rpm -ivh mysql-devel-5.1.73-5.el6_6.x86_64.rpm

Preparing... ########################################### [100%]1:mysql-devel ########################################### [100%]

使用service命令查看MySQL安装状态:

[root@RD-viPORTAL-1mysql]# service mysqld status

mysqld 已停

使用service命令启动MySQL并初始化:

[root@RD-viPORTAL-1mysql]# service mysqld start

初始化 MySQL 数据库: Installing MySQL system tables...

OK

Filling help tables...

OK

To start mysqld at boottimeyou have to copy

support-files/mysql.server to the right place foryour system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER!Todo so, start the server, thenissue the following commands:/usr/bin/mysqladmin -u root password 'new-password'

/usr/bin/mysqladmin -u root -h RD-viPORTAL-1 password 'new-password'Alternatively you can run:/usr/bin/mysql_secure_installationwhichwill also give you the option of removing the test

databases and anonymous user created by default. This is

strongly recommendedforproduction servers.

See the manualfor moreinstructions.

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/usr/mysql-test ; perl mysql-test-run.pl

Please report any problems with the/usr/bin/mysqlbug script![确定]

正在启动 mysqld: [确定]

[root@RD-viPORTAL-1 mysql]#

查询3306端口确认是否正常启动:

[root@RD-viPORTAL-1 mysql]# netstat -an|grep 3306tcp0 0 0.0.0.0:3306 0.0.0.0:*LISTEN

unix2 [ ACC ] STREAM LISTENING 19314 /tmp/orbit-gdm/linc-c5a-0-4d33062e40154

unix3 [ ] STREAM CONNECTED 19323 /tmp/orbit-gdm/linc-c5a-0-4d33062e40154

unix3 [ ] STREAM CONNECTED 19320 /tmp/orbit-gdm/linc-c5a-0-4d33062e40154

MySQL默认配置路径:

[root@RD-viPORTAL-1 mysql]# cd /var/lib/mysql/[root@RD-viPORTAL-1mysql]# ll

总用量20488

-rw-rw---- 1 mysql mysql 10485760 2月 15 05:52ibdata1-rw-rw---- 1 mysql mysql 5242880 2月 15 05:52ib_logfile0-rw-rw---- 1 mysql mysql 5242880 2月 15 05:52ib_logfile1

drwx------ 2 mysql mysql 4096 2月 15 05:52mysql

srwxrwxrwx1 mysql mysql 0 2月 15 05:52mysql.sock

drwx------ 2 mysql mysql 4096 2月 15 05:52 test

三、配置MySQL

设置root用户密码

默认情况下MySQL是不需要登录密码的,为安全起见,设置MySQL密码。

[root@RD-viPORTAL-1 mysql]# mysqladmin -u root password "passw0rd"

此时直接登录显示访问拒绝:

[root@RD-viPORTAL-1mysql]# mysql

ERROR1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

使用如下命令登录MySQL:

[root@RD-viPORTAL-1 mysql]# mysql -u root -p

Enter password:

Welcome to the MySQL monitor. Commands end with ; or g.

Your MySQL connectionid is 10Server version:5.1.73Source distribution

Copyright (c)2000, 2013, 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 clearthe current input statement.

mysql> select *from user;

ERROR1046(3D000): No database selected

mysql>exit

Bye

授权root用户可以远程访问:

[root@RD-viPORTAL-1 mysql]# mysql -u root -p

Enter password:

Welcome to the MySQL monitor. Commands end with ; or g.

Your MySQL connectionid is 12Server version:5.1.73Source distribution

Copyright (c)2000, 2013, 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 clearthe current input statement.

mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password'WITH GRANT OPTION;

Query OK,0 rows affected (0.00sec)

mysql>exit

Bye

[root@RD-viPORTAL-1 mysql]#

linux安装或卸载mysql5,Linux环境下卸载、安装及配置MySQL5.1相关推荐

  1. mysql安装了老版本_Windows环境下MySQL安装教程

    MySQL简介 MySQL是一个关系型数据库管理系统,由瑞典MySQL AB 公司开发,属于 Oracle 旗下产品.MySQL 是最流行的关系型数据库管理系统之一,在 WEB 应用方面,MySQL是 ...

  2. linux mysql5.6编译_Linux 环境下编译安装MySQL5.6的笔记记录

    一.首先搭建好Linux环境,我这边使用的是redhat enterprise 6.5,并且建议磁盘划分逻辑卷,以便后期的扩容工作. 二.环境搭建好了之后,我们就要去准备MySQL的安装文件,到现在为 ...

  3. Linux环境下如何安装达梦数据库

    提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档 Linux环境下如何安装达梦数据库 一.检查服务器防火墙 二.安装步骤 1.创建达梦用户 2.创建达梦目录 3.配置系统限制 4.镜像 ...

  4. linux安装powerline字体,Ubuntu16.04+Anaconda环境下powerline安装,及tmux个性化

    anaconda: 一个开源的Python发行版本,方便管理python环境 powerline:提供了Terminal.VIM等工具中的状态提示功能 tmux:Linux中一种管理窗口的程序,提供窗 ...

  5. Linux系统编程及应用——ubuntu环境下

    Linux系统编程及应用--ubuntu环境下 程序由业务逻辑和系统访问两部分构成的.其中,业务逻辑是根据业务需求,按照设计好的逻辑规则,处理信息,与系统(平台)无关的:而系统访问则是利用操作系统所提 ...

  6. centos7环境下MySQL安装教程

    Linux centos7环境下MySQL安装教程 作者:随缘相识-(志同道合) 字体:[增加 减小] 类型:转载 时间:2017-03-17 我要评论 这篇文章主要为大家详细介绍了Linux cen ...

  7. cuda9.2环境下pip安装tensorflow非官方轮子

    cuda9.2环境下pip安装tensorflow非官方轮子 对于tensorflow,官方的预编译版本只支持cuda9.0,如果是cuda9.2需要自己编译安装. 但是,github上能够查到热心的 ...

  8. ubuntu安装python环境_AirSim 无人驾驶教程(1)Airsim 在Ubuntu环境下的安装

    AirSim 无人驾驶教程(1)Airsim 在Ubuntu环境下的安装 说实话我自己内心是不看好无人驾驶的短期普及的,但是通过对无人驾驶的研究可以实现对一些科学知识的掌握和探索.通过无人驾驶的仿真环 ...

  9. RHEL5.6环境下yum安装MySQL

    RHEL5.6环境下yum安装MySQL记录,2017年2月20日 1.卸载原有的MySQL rpm -qa命令查询是否安装了MySQL [root@localhost mysql]# rpm -qa ...

最新文章

  1. javascript捕获ocx事件
  2. msfvenom生成木马和内网穿透
  3. PADS Layout VX.2.3 制作PCB封装(Decal)时,导入DXF文件
  4. 2018 java蓝桥杯校赛题目
  5. layui templet格式化_layui数据表格日期如何格式化成2012-12-30这样的?
  6. Android系统root破解原理分析
  7. OpenCV图像或视频显示在VC对话框中的方法
  8. sqlite查询空日期类型_SQLite比较日期
  9. 静态include与动态include的区别
  10. flex sdk中mx_internal function getTextField() 这种函数如何调用?
  11. 卫星通信术语名词备忘记录
  12. win7映射网络驱动器消失了_win7系统映射网络驱动器出现问题的解决方法
  13. Arcgis(三)——重分类
  14. 设置8211网口方法并关闭EEE模式
  15. 图神经网络(ICML2022)
  16. Spring基础学习
  17. 计算机c盘如何腾出空间,电脑C盘空间不足,又不知道如何清理?做完这几步,能腾出几十个G...
  18. DirectShow 简介
  19. 学术规范与论文写作 答案
  20. 深富策略主力资金逆势突袭这个版块

热门文章

  1. Kubernetes中Secret使用详解
  2. linux-网络数据包抓取-tcpdump
  3. 手写哈希(实现简单的加数、查询)
  4. Jetty使用教程(四:24-27)—Jetty开发指南
  5. iOS 浅谈:深.浅拷贝与copy.strong
  6. oracle下查询的sql已经超出IIS响应时间
  7. LLVM每日谈之三 如何创建一个LLVM工程
  8. nginx apache mysql php 常用编译参数
  9. 小系统单据自动生成存储过程
  10. C# WinForm 给某动态控件设置 IsBalloon = true的ToolTip 即 气泡状提示