且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在Fedora8上安装MySQL5.0.45的过程

更新时间:2022-09-16 21:49:18

本来想安装最新的5.6.13-1版本,下载下来后,依赖的包rpmlib无处下载,无法只得作罢。从Foreda8的安装光盘中找到了以下文件:

mysql-5.0.45-4.fc8.i386.rpm

mysql-connector-java-3.1.12-3.fc6.i386.rpm

mysql-connector-odbc-3.51.14r248-2.fc8.i386.rpm

mysql-libs-5.0.45-4.fc8.i386.rpm

mysql-server-5.0.45-4.fc8.i386.rpm

估计安装好MySQL有上面这些包就行了。

首先执行的是# rpm -ivh mysql-5.0.45-4.fc8.i386.rpm 
warning: mysql-5.0.45-4.fc8.i386.rpm: Header V3 DSA signature: NOKEY, key ID 4f2a6fd2
error: Failed dependencies:
        perl(DBI) is needed by mysql-5.0.45-4.fc8.i386

于是又到光盘里找来了perl-DBI-1.58-2.fc8.i386.rpm ,继续安装。

# rpm -ivh perl-DBI-1.58-2.fc8.i386.rpm 
warning: perl-DBI-1.58-2.fc8.i386.rpm: Header V3 DSA signature: NOKEY, key ID 4f2a6fd2
Preparing...                ########################################### [100%]
   1:perl-DBI               ########################################### [100%]

这回不错,没啥问题了。再次安装mysql-5.0.45-4.fc8.i386.rpm看看:

# rpm -ivh mysql-5.0.45-4.fc8.i386.rpm 
warning: mysql-5.0.45-4.fc8.i386.rpm: Header V3 DSA signature: NOKEY, key ID 4f2a6fd2
Preparing...                ########################################### [100%]
        file /usr/bin/mysql_config from install of mysql-5.0.45-4.fc8 conflicts with file from package MySQL-devel-advanced-5.6.13-1.rhel5
        file /usr/share/man/man1/mysql_config.1.gz from install of mysql-5.0.45-4.fc8 conflicts with file from package MySQL-devel-advanced-5.6.13-1.rhel5

原来是和之前安装的MySQL-devel-advanced-5.6.13-1.rhel5冲突了,于是执行下面命令删掉它。

# rpm -e MySQL-devel-advanced-5.6.13-1.rhel5

接下来再安装mysql-server-5.0.45-4.fc8.i386.rpm

# rpm -ivh mysql-server-5.0.45-4.fc8.i386.rpm 
warning: mysql-server-5.0.45-4.fc8.i386.rpm: Header V3 DSA signature: NOKEY, key ID 4f2a6fd2
error: Failed dependencies:
        mysql = 5.0.45-4.fc8 is needed by mysql-server-5.0.45-4.fc8.i386
        perl-DBD-MySQL is needed by mysql-server-5.0.45-4.fc8.i386

又少一个perl-DBD-MySQL,从光盘中找来了perl-DBD-MySQL-4.005-2.fc8.1.i386.rpm 继续安:

# rpm -ivh perl-DBD-MySQL-4.005-2.fc8.1.i386.rpm 
warning: perl-DBD-MySQL-4.005-2.fc8.1.i386.rpm: Header V3 DSA signature: NOKEY, key ID 4f2a6fd2
Preparing...                ########################################### [100%]
   1:perl-DBD-MySQL         ########################################### [100%]

OK,万里长征又前进了一步,再安装mysql-5.0.45-4.fc8.i386.rpm,成功了

# rpm -ivh mysql-5.0.45-4.fc8.i386.rpm 
warning: mysql-5.0.45-4.fc8.i386.rpm: Header V3 DSA signature: NOKEY, key ID 4f2a6fd2
Preparing...                ########################################### [100%]
   1:mysql                  ########################################### [100%]

这把取得阶段性成果了。然后执行

# rpm -ivh mysql-server-5.0.45-4.fc8.i386.rpm 
warning: mysql-server-5.0.45-4.fc8.i386.rpm: Header V3 DSA signature: NOKEY, key ID 4f2a6fd2
Preparing...                ########################################### [100%]
   1:mysql-server           ########################################### [100%]

呦西,看来安上了。看看3306端口有没有被监听:

# 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:59782               0.0.0.0:*                   LISTEN      
tcp        0      0 0.0.0.0:111                 0.0.0.0:*                   LISTEN      
tcp        0      0 127.0.0.1:631               0.0.0.0:*                   LISTEN      
tcp        0      0 127.0.0.1:25                0.0.0.0:*                   LISTEN      
tcp        0      0 :::22                       :::*                        LISTEN  

没有,估计安好后MySQL没有自动启动。

进入目录:

# cd /etc/rc.d/init.d

执行# ./mysqld start   (Usage: ./mysqld {start|stop|status|condrestart|restart}

Initializing MySQL database:  Installing MySQL system tables...
OK
Filling help tables...
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

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.
You can start the MySQL daemon with:
cd /usr ; /usr/bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl
cd mysql-test ; perl mysql-test-run.pl

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
                                                           [  OK  ]
Starting MySQL:                                            [  OK  ]

再看看端口3306

# 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:59782               0.0.0.0:*                   LISTEN      
tcp        0      0 0.0.0.0:3306                0.0.0.0:*                   LISTEN      
tcp        0      0 0.0.0.0:111                 0.0.0.0:*                   LISTEN      
tcp        0      0 127.0.0.1:631               0.0.0.0:*                   LISTEN      
tcp        0      0 127.0.0.1:25                0.0.0.0:*                   LISTEN      
tcp        0      0 :::22                       :::*                        LISTEN     

再在命令行里输入MySQL,mysql的命令行就出来了。

执行show databases;

熟悉的information_schma,mysql,test就显示出来了。

到此安装成功。

如果上文有什么问题或是疑点,请指点,先谢谢了。















本文转自张昺华-sky博客园博客,原文链接:http://www.cnblogs.com/xiandedanteng/p/3267871.html,如需转载请自行联系原作者