通过配置将Redhat使用CentOS的yum库。
从拖管方那拿到服务器后发现里面已经存在了数据库,
但是通过rpm -qa | grep mysql却无法找到已经安装的数据库
通过find / -name mysql 发现如下结果:
[root@HOHO ~]# find / -name mysql
/usr/local/mysql
/usr/local/mysql/include/mysql
/usr/local/mysql/lib/mysql
/usr/local/mysql/var/mysql
/usr/local/mysql/share/mysql
/usr/local/mysql/bin/mysql
/usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/DBD/mysql
/usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/auto/DBD/mysql
/usr/lib64/mysql
/var/lib/mysql
/var/lib/mysql/mysql
运行/usr/local/mysql/bin/mysql --version发现客户端是5.0老版本的,于是想到删除老的mysql
由于没有rpm包,所以无法通过rpm -e --nodeps mysql来删除mysql包
只好通过如下方式删除:
[root@HOHO ~]# rm -rf /usr/local/mysql/
[root@HOHO ~]# find / -name mysql
/usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/DBD/mysql
/usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/auto/DBD/mysql
/usr/lib64/mysql
/var/lib/mysql
/var/lib/mysql/mysql
[root@HOHO ~]# ll /usr/lib64/mysql/
总计 4
drwxr-xr-x 3 root root 4096 07-20 10:55 plugin
[root@HOHO ~]# rm -rf /var/lib/mysql/
[root@HOHO ~]# find / -name mysql
/usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/DBD/mysql
/usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/auto/DBD/mysql
/usr/lib64/mysql
删除成功后,打算用yum install mysql安装,装完后发现版本还不是最新的5.5.14,
所以又通过yum remove mysql删除。
从mysql.com官网下载以下三个文件:
(1)MySQL-server-5.5.14-1.rhel5.x86_64
(2)MySQL-shared-5.5.14-1.rhel5.x86_64
(3)MySQL-client-5.5.14-1.rhel5.x86_64
按照以上顺序,安装如下:
[root@HOHO ~]# rpm -Uvh MySQL-server-5.5.14-1.rhel5.x86_64.rpm
Preparing... ########################################### [100%]
1:MySQL-server ########################################### [100%]
PLEASE 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 uhz000153.hichina.com password 'new-password'
Alternatively you can run:
/usr/bin/mysql_secure_installation
which 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.
Please report any problems with the /usr/bin/mysqlbug script!
[root@HOHO ~]# find / -name mysql
/usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/DBD/mysql
/usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/auto/DBD/mysql
/usr/lib64/mysql
/usr/share/mysql
/etc/logrotate.d/mysql
/etc/rc.d/init.d/mysql
/var/lib/mysql
/var/lib/mysql/mysql
[root@HOHO ~]# find / -name mysqladmin
[root@HOHO ~]# rpm -Uvh MySQL-shared-5.5.14-1.rhel5.x86_64.rpm
Preparing... ########################################### [100%]
1:MySQL-shared ########################################### [100%]
[root@HOHO ~]# find / -name mysqladmin
[root@HOHO ~]# find / -name mysql
/usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/DBD/mysql
/usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/auto/DBD/mysql
/usr/lib64/mysql
/usr/share/mysql
/etc/logrotate.d/mysql
/etc/rc.d/init.d/mysql
/var/lib/mysql
/var/lib/mysql/mysql
[root@HOHO ~]# rpm -Uvh MySQL-client-5.5.14-1.rhel5.x86_64.rpm
Preparing... ########################################### [100%]
1:MySQL-client ########################################### [100%]
[root@HOHO ~]# find / -name mysql
/usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/DBD/mysql
/usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/auto/DBD/mysql
/usr/lib64/mysql
/usr/share/mysql
/usr/bin/mysql
/etc/logrotate.d/mysql
/etc/rc.d/init.d/mysql
/var/lib/mysql
/var/lib/mysql/mysql
[root@HOHO ~]#
注意:如果安装过程中出错,有可能是原来的没有删干净造成的,再find下,再rm下就好。
安装成功后,注意这段提示:
Alternatively you can run:
/usr/bin/mysql_secure_installation
which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.
如果是产品运行环境,可以通过/usr/bin/mysql_secure_installation进行配置。
其过程大致如下:
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MySQL to secure it, we'll need the current
password for the root user. If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none):
mysql: Unknown OS character set 'GB18030'.
mysql: Switching to the default character set 'latin1'.
OK, successfully used password, moving on...
Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.
You already have a root password set, so you can safely answer 'n'.
Change the root password? [Y/n] n
... skipping.
By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] Y
mysql: Unknown OS character set 'GB18030'.
mysql: Switching to the default character set 'latin1'.
... Success!
Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] Y
mysql: Unknown OS character set 'GB18030'.
mysql: Switching to the default character set 'latin1'.
... Success!
By default, MySQL comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] Y
- Dropping test database...
mysql: Unknown OS character set 'GB18030'.
mysql: Switching to the default character set 'latin1'.
... Success!
- Removing privileges on test database...
mysql: Unknown OS character set 'GB18030'.
mysql: Switching to the default character set 'latin1'.
... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] Y
mysql: Unknown OS character set 'GB18030'.
mysql: Switching to the default character set 'latin1'.
... Success!
Cleaning up...
All done! If you've completed all of the above steps, your MySQL
installation should now be secure.
Thanks for using MySQL!
在linux SHELL中输入mysql会有类似mysql无法识别OS Characterset GB18030,
mysql: Unknown OS character set 'GB18030'.
mysql: Switching to the default character set 'latin1'.
采用默认的latin1之类的信息,表明操作系统的编码设置需要修改,描述如下:
查看操作系统的字符集
#locale
LANG=utf8
LC_CTYPE="utf8"
LC_NUMERIC="utf8"
LC_TIME="utf8"
LC_COLLATE="utf8"
LC_MONETARY="utf8"
LC_MESSAGES="utf8"
LC_PAPER="utf8"
LC_NAME="utf8"
LC_ADDRESS="utf8"
LC_TELEPHONE="utf8"
LC_MEASUREMENT="utf8"
LC_IDENTIFICATION="utf8"
LC_ALL=
如果不是这样,则需要对操作系统字符集进行修改:
#vim /etc/syconfig/i18n
修改成:LANG="zh_CN.UTF-8"即可
另外,再查看一下环境变量的设置
#vim /etc/profile
里面可以没有字符集的设置,如果有,应类似如下设置:
写道
export LC_ALL="C"
#export LANG="zh_CN.UTF-8"
设置完成后,
#source /etc/profile
使环境变量生效,如果不放心,可以reboot
如果要通过命令创建UTF-8格式的数据库,需通过如下方式:
CREATE DATABASE `test2` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci
(如果是GBK,则用create database test2 DEFAULT CHARACTER SET gbk COLLATE gbk_chinese_ci;)
增加用户
shell> mysql --user=root mysql
mysql> GRANT ALL PRIVILEGES ON *(or DBName).* TO monty@localhost
IDENTIFIED BY 'something' WITH GRANT OPTION;
mysql> GRANT ALL PRIVILEGES ON *(or DBName).* TO monty@"%"
IDENTIFIED BY 'something' WITH GRANT OPTION;
mysql> GRANT RELOAD,PROCESS ON *(or DBName).* TO admin@localhost;
mysql> GRANT USAGE ON *.* TO dummy@localhost;
分享到:
相关推荐
在Linux RedHat环境下安装MySQL是一项基础且重要的任务,尤其对于那些需要在服务器上部署数据库服务的开发者和系统管理员来说。MySQL是一种广泛使用的开源关系型数据库管理系统(RDBMS),它以其高效、稳定和易于...
超详细的操作步骤, 在Redhat linux 7.5版本中安装 mysql 5.6版本的数据库. 1 卸载已有mysql, 使用yum(附带yum源的设置步骤)安装依赖 2 下载mysql 5.6文件 3 上传文件到linux 4 安装rpm包 5 设置可远程连接 6 ...
### Linux RedHat 下安装 MySQL 步骤详解 #### 一、前言 在 Linux RedHat 系统上安装 MySQL 数据库是一项常见的系统管理任务。本文将详细介绍如何在 RedHat 系统上安装 MySQL,并覆盖安装前的准备、安装过程、验证...
标题:Linux Redhat5 下安装 Oracle11g 描述:本文将根据作者的实际安装经验,提供一步步的安装指导,旨在帮助读者顺利地安装 Oracle 11g 在 Redhat 5 操作系统下。 标签:Linux Redhat5 Oracle 安装 VMware 安装...
RedHat 7.9 安装 MySQL 8.0 MGR RedHat 7.9 安装 MySQL 8.0 MGR 是一种高可用性的数据库解决方案,它可以提供高性能、可扩展性和高可用性的数据库服务。在本文中,我们将指导您如何在 RedHat 7.9 上安装 MySQL 8.0 ...
在RedHat 5.4 Linux系统中安装MySQL5.0是一个关键的过程,涉及到多个步骤,包括下载和安装源代码、配置文件、用户权限设定以及数据库初始化。以下是对这些步骤的详细解释: 1. **下载与安装**: 首先,你需要获取...
在Redhat系统上安装MySQL 5.5是一个涉及多个步骤的过程,这包括配置环境、下载安装包、编译源码以及设置数据库参数等。在这个过程中,`my.cnf`文件扮演着至关重要的角色,它是MySQL服务器的主要配置文件,用于定制...
RedHat Linux安装图解RedHat Linux安装图解RedHat Linux安装图解RedHat Linux安装图解
本文将详细阐述如何在Red Hat Enterprise Linux 5(简称Redhat5)上安装MySQL数据库系统,重点是利用提供的两个 RPM 包——MySQL-server-community-5.1.62-1.rhel5.i386.rpm 和 MySQL-client-community-5.1.62-1....
### RedHat 5 下 MySQL 5.6 的安装与简单维护 #### 一、环境准备与软件需求 在开始之前,我们需要确保以下条件得到满足: 1. **操作系统**:RedHat 5 操作系统。 2. **软件包**:MySQL 5.6 的 RPM 包。包括但不...
RHEL Linux 7详细安装MySQL8.0.2的详细步骤,以及完整的安装包。非常详细。
### RedHat Linux 7.2 安装 MySQL 5.7 的详细步骤 #### 安装前的准备工作 在开始安装 MySQL 5.7 之前,确保已经做好了以下准备工作: 1. **登录用户**: 以 root 用户身份登录到 RedHat Linux 7.2 系统。 2. **...
RedHAT7 上安装MySQL 8.0.X版本安装,视频为一步一步安装,MySQL升级之后安装方式均为全新,
本文档详细记录了在64位RedHat系统下安装DBI(Database Interface)和DBD(Database Driver)- MySQL的过程及遇到的问题。起初作者并未意识到在64位RedHat环境下安装DBI和DBD-Mysql会遇到挑战,但在实际操作过程中...
以下是如何在Linux下彻底卸载由RPM或yum安装的MySQL的详细步骤: 1. **停止MySQL服务**: 首先,确保MySQL服务已经停止,以防止在卸载过程中发生任何问题。你可以使用以下命令来停止服务: ``` sudo systemctl ...
在Red Hat Linux操作系统中安装MySQL 5.0.45是一个关键的过程,这对于任何需要使用MySQL数据库服务的系统管理员来说都是必要的。以下是安装的详细步骤: 1. 首先,确保你的系统已经更新到最新版本,以获取所有必要...