欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

Linux Mysql知识学习篇

程序员文章站 2022-05-29 12:14:31
...

1.查看Linux 是否安装了Mysql[root@localhost zhoulinghong]# rpm -qa |grep MySQL MySQL-server-community-5.1.22-0.rhel4已经安装了

1.查看Linux 是否安装了Mysql

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

MySQL-server-community-5.1.22-0.rhel4

已经安装了。

2.Linux 下安装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

Support MySQL by buying support/licenses at

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

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

Linux Mysql知识学习篇