Redhat企业版5.5下Mysql的安装与配置

因为Red Hat enterprise linux 5 自带了一个mysql,所以当你安装新的mysql时,就会提示错误如:

error:Failed dependencies:

       MySQL conflicts with mysql-server-5.0.77-4.el5_4.2.i386

rpm -qa|grep mysql 可以看到安装的mysql,运行后我的系统里出现如下mysql:
mysql-server-5.0.77-4.el5_4.2
libdbi-dbd-mysql-0.8.1a-1.2.2
mysql-connector-odbc-3.51.26r1127-1.el5

于是将自带的版本卸载,有些人说得从最后一个往前卸,其实这个没关系,我就是从第一个开始卸载的。但是卸载时出现两个问题:

问题一:

运行命令:rpm -e mysql-server-5.0.77-4.e15_4.2
出错提示: error: package mysql-server-5.0.77-4.e15_4.2 is not installed

解决:rpm -e mysql-server-5.0.77(这个原因很奇怪,估计是后面的一串数字不是表示版本号的……)

问题二:dependencies问题

运行命令:rpm -e mysql-server-5.0.77-4.el5_4.2
error:Failed dependencies:

libmysqlcient.so.................................................................i386

limysqlclient.so...................................................................i386

解决:

在卸载命令后加参数以不考虑dependencies,问题解决

rpm -e mysql-server-5.0.77 --nodeps

安装:

一、安装服务器端

(1)在目录/usr/local下有两个rmp文件的目录下运行如下命令:

[root@localhost local]#rpm –ivh MySQL-server-5.1.52-1.glibc23.i386.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 localhost.localdomain 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!

Starting MySQL..[确定]

如出现如上信息,服务端安装完毕。

(2)、测试服务端安装是否成功,可运行netstat看Mysql端口是否打开,如打开表示服务已经启动,安装成功。Mysql默认的端口是3306。

[root@localhost local]# netstat -nat

显示如下信息:

Active Internet connections (servers and established)

Proto Recv-Q Send-Q Local Address  Foreign Address     State

tcp  0  0 0.0.0.0:3306     0.0.0.0:*      LISTEN

上面显示可以看出MySQL服务已经启动。

二、安装客户端

运行如下命令:

[root@localhost local]# rpm -ivh MySQL-client-5.1.52-1.glibc23.i386.rpm

Preparing……    ########################################### [100%]

1:MySQL-client  ########################################### [100%]

显示安装完毕。

三、登录MySQL

(1)、MySQL默认用户是root,由于初始没有密码,第一次进时只需键入mysql即可。

[root@localhost local]# mysql

出现了“mysql>”提示符,恭喜你,安装成功!

(2)、增加了密码后的登录格式如下:

mysql -u root -p

Enter password: (输入密码)

四、修改登录密码

/usr/bin/mysqladmin -u root password 'new-password'

五、启动与停止

(1)、启动

[root@localhost init.d]# /etc/init.d/mysql start

(2)、停止

/usr/bin/mysqladmin -u root -p shutdown

(3)、自动启动

/sbin/chkconfig mysql on

六、开启远程连接

GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'%' IDENTIFIED BY 'mypassword' WITH GRANT OPTION; 

注意:service mysql start

  service mysql restart

  service mysql stop

 

更多嵌入式linux及编程学习交流的文章,请访问我的个人网站”恩享网” :http://www.enxiang.icoc.cc,期待与您共同进步。

 

转载于:https://www.cnblogs.com/LJTbozai/archive/2013/04/22/3036326.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值