通过配置将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步骤
超详细的操作步骤, 在Redhat linux 7.5版本中安装 mysql 5.6版本的数据库. 1 卸载已有mysql, 使用yum(附带yum源的设置步骤)安装依赖 2 下载mysql 5.6文件 3 上传文件到linux 4 安装rpm包 5 设置可远程连接 6 ...
NULL 博文链接:https://my5622576.iteye.com/blog/411224
RedHat下安装mysql,并附上一小段C测试程序,测试是否可用。
本次采用二进制安装linux mysql数据库 二进制(Binary Package) 优点 安装简单;可以安装到任何路径下,灵活性好;一台服务器可以安装多个MySQL 缺点 已经经过编译,性能不如源码编译的好;不能灵活定制编译参数 ...
只是我结合自己的实际情况进行安装,百分百通过的,期间在网上找了各种资料,才得以在redhat5上装好oracle 11g
RedHat 7.9安装MySQL 8.0 MGR
RedHat Linux安装图解RedHat Linux安装图解RedHat Linux安装图解RedHat Linux安装图解
RHEL Linux 7详细安装MySQL8.0.2的详细步骤,以及完整的安装包。非常详细。
安装mysql5.7 卸载默认mariadb rpm–qa| grep mairadb rpm–e –nodepsmariadb-libs-5.5.56-2.el7.x86_64 下载软件并上传到服务器 安装 –vxfmysql-5.7.20-1.el7.x86_64.rpm-bundle.tar rpm ...
Redhat Linux 5.8 安装手册
Oracle 10g 在linux redhat 5.5系统安装图解全过程
这是redhat linux 5.6 64位系统的安装。
Oracle 10g 在linux redhat 5.3系统安装图解全过程
redhat安装mysql5.0.45详细步骤。
redhat enterprise linux5 mysql安装文件
本文详细说明如何在RedHat Linux7.2安装MySQL5.7的方法
redhat5下mysql5.6的安装与简单维护,希望大家喜欢!
详细介绍了linux redhat enterprise 5.4的安装过程以及oracle 10g的安装过程以及vnc服务的配置
RedHat Enterprise Linux 6.9安装64位Oracal10g图解全过程适合新手.doc