linux mysql相关课程_一点一滴学习Linux--Mysql篇

1.查看是否安装了Mysql

[root@localhost zhoulinghong]# rpm -qa |grep MySQL

MySQL-server-community-5.1.22-0.rhel4

已经安装了。

2.安装mysql(rpm)

[root@localhost zhoulinghong]# rpm -ivh MySQL-server-community-5.1.22-0.rhel4.i386.rpm

warning: MySQL-server-community-5.1.22-0.rhel4.i386.rpm: V3 DSA signature: NOKEY, key ID 5072e1f5

error: Failed dependencies:

perl(DBI) is needed by MySQL-server-community-5.1.22-0.rhel4.i386

Suggested resolutions:

perl-DBI-1.40-5.i386.rpm

呵呵,出错了。Linux的弊端就出现了。安装软件的时候相互依赖太强了。。。看到上面错误信息是缺少perl-DBI-1.40-5.i386.rpm包。没有办法只能安装了

3.安装依赖包

perl-DBI-1.40-5.i386.rpm 这个包在Redhat的CD2中。不用多想挂载光驱吧。

[root@localhost mnt]# mount /dev/cdrom /mnt/cdrom

挂载成功以后。转到 /mnt/cdrom/RedHat/RPMS目录下面就有perl-DBI-1.40-5.i386.rpm 这个包了。

[root@localhost RPMS]# rpm -ivh perl-DBI-1.40-5.i386.rpm

warning: perl-DBI-1.40-5.i386.rpm: V3 DSA signature: NOKEY, key ID db42a60e

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

1:perl-DBI               ########################################### [100%]

安装成功。

OK,到现在的依赖包也安装完了,就可以安装mysql了。(注意:因为大家的环境不一样,中间可能有其他的依赖包需要安装,方法照上面就好了。)

4.安装Mysql

[root@localhost zhoulinghong]# rpm -ihv MySQL-server-community-5.1.22-0.rhel4.i386.rpm

warning: MySQL-server-community-5.1.22-0.rhel4.i386.rpm: V3 DSA signature: NOKEY, key ID 5072e1f5

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

1:MySQL-server-community ########################################### [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'

See the manual for more instructions.

Please 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

Notes regarding SELinux on this platform:

=========================================

The default policy might cause server startup to fail because it is

not allowed to access critical files. In this case, please update

your installation.

The default policy might also cause inavailability of SSL related

features because the server is not allowed to access /dev/random

and /dev/urandom. If this is a problem, please do the following:

1) install selinux-policy-targeted-sources from your OS vendor

2) add the following two lines to /etc/selinux/targeted/src/policy/domains/program/mysqld.te:

allow mysqld_t random_device_t:chr_file read;

allow mysqld_t urandom_device_t:chr_file read;

3) cd to /etc/selinux/targeted/src/policy and issue the following command:

make load

Starting MySQL[  OK  ]

Giving mysqld 2 seconds to start

很明显,安装成功了。如果安装失败了就卸载一次在安装一下就基本没有什么问题了。

5.查看mysql的状态

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

MySQL running (5885)                                       [ 确定 ]

6.卸载Mysql

[root@localhost zhoulinghong]# rpm -ev MySQL-server-community-5.1.22-0.rhel4

7.安装客户端

[root@localhost zhoulinghong]# rpm -ivh MySQL-client-community-5.1.22-0.rhel4.i386.rpm

warning: MySQL-client-community-5.1.22-0.rhel4.i386.rpm: V3 DSA signature: NOKEY, key ID 5072e1f5

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

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

安装成功。呵呵,还挺顺利的。

8.使用客户端连接

[root@localhost zhoulinghong]# /usr/bin/mysql

成功。

最重要一点.你这个时候可以发现,在本机器上可以连接MySql.但是在其他机器上用相同方法,会出现" Can't connect to MySQL server on '9.186.100.178' (10065)"的错误.分析原因是AS4的防火墙导致.用下面方法设置防火墙:打开文件/etc/sysconfig/iptables,在最后一条之前加一条:-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT. 然后执行 /etc/init.d/iptables restart. 至此设置AS4防火墙完毕

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值