1.挂载操作系统介质
[root@server-556 ~]# mkdir -p /media/dvd [root@server-556 ~]# mount -t iso9660 -o loop RHEL6.4-20130130.0-Server-x86_64-DVD1.iso /media/dvd
3.查看myql相关rpm包
[root@server-556 ~]# cd /media/dvd/Packages/ [root@server-556 Packages]# ls | grep mysql dovecot-mysql-2.0.9-5.el6.x86_64.rpm libdbi-dbd-mysql-0.8.3-5.1.el6.x86_64.rpm mod_auth_mysql-3.0.0-11.el6_0.1.x86_64.rpm mysql-5.1.66-2.el6_3.x86_64.rpm mysql-bench-5.1.66-2.el6_3.x86_64.rpm mysql-connector-java-5.1.17-6.el6.noarch.rpm mysql-connector-odbc-5.1.5r1144-7.el6.x86_64.rpm mysql-devel-5.1.66-2.el6_3.i686.rpm mysql-devel-5.1.66-2.el6_3.x86_64.rpm mysql-libs-5.1.66-2.el6_3.i686.rpm mysql-libs-5.1.66-2.el6_3.x86_64.rpm mysql-server-5.1.66-2.el6_3.x86_64.rpm mysql-test-5.1.66-2.el6_3.x86_64.rpm php-mysql-5.3.3-22.el6.x86_64.rpm qt-mysql-4.6.2-25.el6.i686.rpm qt-mysql-4.6.2-25.el6.x86_64.rpm rsyslog-mysql-5.8.10-6.el6.x86_64.rpm
3.安装mysql
[root@server-556 Packages]# rpm -ivh mysql-5.1.66-2.el6_3.x86_64.rpm warning: mysql-5.1.66-2.el6_3.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY Preparing... ########################################### [100%] 1:mysql ########################################### [100%]
4.安装mysql-server
[root@server-556 Packages]# rpm -ivh mysql-server-5.1.66-2.el6_3.x86_64.rpm warning: mysql-server-5.1.66-2.el6_3.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY error: Failed dependencies: perl-DBD-MySQL is needed by mysql-server-5.1.66-2.el6_3.x86_64
发现要安装先perl-DBD-MySQL.先查看需要安装的该rpm的版本,再安装
[root@server-556 Packages]# ls | grep perl-DBD-MySQL perl-DBD-MySQL-4.013-3.el6.x86_64.rpm [root@server-556 Packages]# rpm -ivh perl-DBD-MySQL-4.013-3.el6.x86_64.rpm warning: perl-DBD-MySQL-4.013-3.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY Preparing... ########################################### [100%] 1:perl-DBD-MySQL ########################################### [100%]
重新安装mysql-server
[root@server-556 Packages]# rpm -ivh mysql-server-5.1.66-2.el6_3.x86_64.rpm warning: mysql-server-5.1.66-2.el6_3.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY Preparing... ########################################### [100%] 1:mysql-server ########################################### [100%]
5.启动mysqld服务
[root@server-556 Packages]# service mysqld start 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 server-556 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. 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 /usr/mysql-test ; perl mysql-test-run.pl Please report any problems with the /usr/bin/mysqlbug script! [ OK ] Starting mysqld: [ OK ]
6.修改root密码
[root@server-556 Packages]# mysqladmin -u root password '123456'
7.登录mysql
[root@server-556 Packages]# mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or g. Your MySQL connection id is 4 Server version: 5.1.66 Source distribution Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or 'h' for help. Type 'c' to clear the current input statement. mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | test | +--------------------+ 3 rows in set (0.00 sec)