先看原来版本
[root@iZ941149niaZ mysql]# rpm -qa |grep mysql
mysql-devel-5.1.73-7.el6.x86_64mysql-libs-5.1.73-7.el6.x86_64
mysql-5.1.73-7.el6.x86_64
自动删除原来的
[root@iruda ~]$yum remove MySQL-python.x86_64 mysql-libs.x86_64
Loaded plugins: security
Setting up Remove Process
No Match for argument: MySQL-python.x86_64
base | 3.7 kB 00:00
base/primary_db | 4.7 MB 00:00
epel | 4.3 kB 00:00
epel/primary_db | 5.9 MB 00:00
extras | 3.4 kB 00:00
extras/primary_db | 29 kB 00:00
updates | 3.4 kB 00:00
updates/primary_db | 4.7 MB 00:00
Package(s) MySQL-python.x86_64 available, but not installed.
Resolving Dependencies
--> Running transaction check
---> Package mysql-libs.x86_64 0:5.1.73-3.el6_5 will be erased
--> Processing Dependency: libmysqlclient.so.16()(64bit) for package: 2:postfix-2.6.6-6.el6_5.x86_64
--> Processing Dependency: libmysqlclient.so.16(libmysqlclient_16)(64bit) for package: 2:postfix-2.6.6-6.el6_5.x86_64
--> Processing Dependency: mysql-libs for package: 2:postfix-2.6.6-6.el6_5.x86_64
--> Running transaction check
---> Package postfix.x86_64 2:2.6.6-6.el6_5 will be erased
--> Processing Dependency: /usr/sbin/sendmail for package: redhat-lsb-core-4.0-7.el6.centos.x86_64
--> Processing Dependency: /usr/sbin/sendmail for package: cronie-1.4.4-12.el6.x86_64
--> Running transaction check
---> Package cronie.x86_64 0:1.4.4-12.el6 will be erased
--> Processing Dependency: cronie = 1.4.4-12.el6 for package: cronie-anacron-1.4.4-12.el6.x86_64
---> Package redhat-lsb-core.x86_64 0:4.0-7.el6.centos will be erased
--> Running transaction check
---> Package cronie-anacron.x86_64 0:1.4.4-12.el6 will be erased
--> Processing Dependency: /etc/cron.d for package: crontabs-1.10-33.el6.noarch
--> Processing Dependency: /etc/cron.d for package: sysstat-9.0.4-22.el6.x86_64
--> Restarting Dependency Resolution with new changes.
--> Running transaction check
---> Package crontabs.noarch 0:1.10-33.el6 will be erased
---> Package sysstat.x86_64 0:9.0.4-22.el6 will be erased
--> Finished Dependency Resolution
Dependencies Resolved
=====================================================================================================================================================================================================================================
Package Arch Version Repository Size
=====================================================================================================================================================================================================================================
Removing:
mysql-libs x86_64 5.1.73-3.el6_5 @updates 4.0 M
Removing for dependencies:
cronie x86_64 1.4.4-12.el6 @anaconda-CentOS-201311291202.x86_64/6.5 174 k
cronie-anacron x86_64 1.4.4-12.el6 @anaconda-CentOS-201311291202.x86_64/6.5 43 k
crontabs noarch 1.10-33.el6 @anaconda-CentOS-201311291202.x86_64/6.5 2.4 k
postfix x86_64 2:2.6.6-6.el6_5 @updates 9.7 M
redhat-lsb-core x86_64 4.0-7.el6.centos @anaconda-CentOS-201311291202.x86_64/6.5 22 k
sysstat x86_64 9.0.4-22.el6 @anaconda-CentOS-201311291202.x86_64/6.5 824 k
Transaction Summary
=====================================================================================================================================================================================================================================
Remove 7 Package(s)
Installed size: 15 M
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Erasing : redhat-lsb-core-4.0-7.el6.centos.x86_64 1/7
Erasing : sysstat-9.0.4-22.el6.x86_64 2/7
/var/tmp/rpm-tmp.plqKyL: line 1: lsb_release: command not found
Erasing : cronie-1.4.4-12.el6.x86_64 3/7
Erasing : cronie-anacron-1.4.4-12.el6.x86_64 4/7
Erasing : crontabs-1.10-33.el6.noarch 5/7
Erasing : 2:postfix-2.6.6-6.el6_5.x86_64 6/7
Erasing : mysql-libs-5.1.73-3.el6_5.x86_64 7/7
Verifying : cronie-anacron-1.4.4-12.el6.x86_64 1/7
Verifying : mysql-libs-5.1.73-3.el6_5.x86_64 2/7
Verifying : redhat-lsb-core-4.0-7.el6.centos.x86_64 3/7
Verifying : crontabs-1.10-33.el6.noarch 4/7
Verifying : sysstat-9.0.4-22.el6.x86_64 5/7
Verifying : cronie-1.4.4-12.el6.x86_64 6/7
Verifying : 2:postfix-2.6.6-6.el6_5.x86_64 7/7
Removed:
mysql-libs.x86_64 0:5.1.73-3.el6_5
Dependency Removed:
cronie.x86_64 0:1.4.4-12.el6 cronie-anacron.x86_64 0:1.4.4-12.el6 crontabs.noarch 0:1.10-33.el6 postfix.x86_64 2:2.6.6-6.el6_5 redhat-lsb-core.x86_64 0:4.0-7.el6.centos sysstat.x86_64 0:9.0.4-22.el6
Complete!
[root@iruda ~]$whereis mysql
mysql:
[root@iruda ~]$yum list mysql*
Loaded plugins: security
Available Packages
MySQL-python.x86_64 1.2.3-0.3.c1.1.el6 base
MySQL-zrm.noarch 3.0-6.el6.1 epel
mysql.x86_64 5.1.73-8.el6_8 base
mysql++.i686 3.0.9-3.el6 epel
mysql++.x86_64 3.0.9-3.el6 epel
mysql++-devel.i686 3.0.9-3.el6 epel
mysql++-devel.x86_64 3.0.9-3.el6 epel
mysql++-manuals.x86_64 3.0.9-3.el6 epel
mysql-bench.x86_64 5.1.73-8.el6_8 base
mysql-connector-java.noarch 1:5.1.17-6.el6 base
mysql-connector-odbc.x86_64 5.1.5r1144-7.el6 base
mysql-connector-python.noarch 1.1.6-1.el6 epel
mysql-devel.i686 5.1.73-8.el6_8 base
mysql-devel.x86_64 5.1.73-8.el6_8 base
mysql-embedded.i686 5.1.73-8.el6_8 base
mysql-embedded.x86_64 5.1.73-8.el6_8 base
mysql-embedded-devel.i686 5.1.73-8.el6_8 base
mysql-embedded-devel.x86_64 5.1.73-8.el6_8 base
mysql-libs.i686 5.1.73-8.el6_8 base
mysql-libs.x86_64 5.1.73-8.el6_8 base
mysql-mmm.noarch 2.2.1-2.el6 epel
mysql-mmm-agent.noarch 2.2.1-2.el6 epel
mysql-mmm-monitor.noarch 2.2.1-2.el6 epel
mysql-mmm-tools.noarch 2.2.1-2.el6 epel
mysql-proxy.i686 0.8.5-2.el6 epel
mysql-proxy.x86_64 0.8.5-2.el6 epel
mysql-proxy-devel.i686 0.8.5-2.el6 epel
mysql-proxy-devel.x86_64 0.8.5-2.el6 epel
mysql-server.x86_64 5.1.73-8.el6_8 base
mysql-test.x86_64 5.1.73-8.el6_8 base
mysql-utilities.noarch 1.3.6-1.el6 epel
mysqlreport.noarch 3.5-4.el6 epel
mysqltuner.noarch 1.6.0-1.el6 epel
[root@iruda ~]$yum install mysql-server
Loaded plugins: security
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package mysql-server.x86_64 0:5.1.73-8.el6_8 will be installed
--> Processing Dependency: mysql = 5.1.73-8.el6_8 for package: mysql-server-5.1.73-8.el6_8.x86_64
--> Processing Dependency: perl-DBI for package: mysql-server-5.1.73-8.el6_8.x86_64
--> Processing Dependency: perl-DBD-MySQL for package: mysql-server-5.1.73-8.el6_8.x86_64
--> Processing Dependency: perl(DBI) for package: mysql-server-5.1.73-8.el6_8.x86_64
--> Processing Dependency: libmysqlclient_r.so.16(libmysqlclient_16)(64bit) for package: mysql-server-5.1.73-8.el6_8.x86_64
--> Processing Dependency: libmysqlclient.so.16(libmysqlclient_16)(64bit) for package: mysql-server-5.1.73-8.el6_8.x86_64
--> Processing Dependency: libmysqlclient_r.so.16()(64bit) for package: mysql-server-5.1.73-8.el6_8.x86_64
--> Processing Dependency: libmysqlclient.so.16()(64bit) for package: mysql-server-5.1.73-8.el6_8.x86_64
--> Running transaction check
---> Package mysql.x86_64 0:5.1.73-8.el6_8 will be installed
---> Package mysql-libs.x86_64 0:5.1.73-8.el6_8 will be installed
---> Package perl-DBD-MySQL.x86_64 0:4.013-3.el6 will be installed
---> Package perl-DBI.x86_64 0:1.609-4.el6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=====================================================================================================================================================================================================================================
Package Arch Version Repository Size
=====================================================================================================================================================================================================================================
Installing:
mysql-server x86_64 5.1.73-8.el6_8 base 8.6 M
Installing for dependencies:
mysql x86_64 5.1.73-8.el6_8 base 895 k
mysql-libs x86_64 5.1.73-8.el6_8 base 1.2 M
perl-DBD-MySQL x86_64 4.013-3.el6 base 134 k
perl-DBI x86_64 1.609-4.el6 base 705 k
Transaction Summary
=====================================================================================================================================================================================================================================
Install 5 Package(s)
Total download size: 12 M
Installed size: 33 M
Is this ok [y/N]: y
Downloading Packages:
(1/5): mysql-5.1.73-8.el6_8.x86_64.rpm | 895 kB 00:00
(2/5): mysql-libs-5.1.73-8.el6_8.x86_64.rpm | 1.2 MB 00:00
(3/5): mysql-server-5.1.73-8.el6_8.x86_64.rpm | 8.6 MB 00:00
(4/5): perl-DBD-MySQL-4.013-3.el6.x86_64.rpm | 134 kB 00:00
(5/5): perl-DBI-1.609-4.el6.x86_64.rpm | 705 kB 00:00
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 5.8 MB/s | 12 MB 00:01
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : mysql-libs-5.1.73-8.el6_8.x86_64 1/5
Installing : perl-DBI-1.609-4.el6.x86_64 2/5
Installing : perl-DBD-MySQL-4.013-3.el6.x86_64 3/5
Installing : mysql-5.1.73-8.el6_8.x86_64 4/5
Installing : mysql-server-5.1.73-8.el6_8.x86_64 5/5
Verifying : perl-DBD-MySQL-4.013-3.el6.x86_64 1/5
Verifying : mysql-libs-5.1.73-8.el6_8.x86_64 2/5
Verifying : mysql-server-5.1.73-8.el6_8.x86_64 3/5
Verifying : mysql-5.1.73-8.el6_8.x86_64 4/5
Verifying : perl-DBI-1.609-4.el6.x86_64 5/5
Installed:
mysql-server.x86_64 0:5.1.73-8.el6_8
Dependency Installed:
mysql.x86_64 0:5.1.73-8.el6_8 mysql-libs.x86_64 0:5.1.73-8.el6_8 perl-DBD-MySQL.x86_64 0:4.013-3.el6 perl-DBI.x86_64 0:1.609-4.el6
Complete!
[root@iruda ~]$service mysql start
mysql: unrecognized service
[root@iruda ~]$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 iZwz93m946fob7bpbd09clZ 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 ]
[root@iruda ~]$
[root@iruda ~]$mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.1.73 Source distribution
Copyright (c) 2000, 2013, 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> \q
Bye
[root@iruda ~]$chkconfig mysqld on
[root@iruda ~]$/sbin/iptables -I INPUT -p tcp --dport 3306 -j ACCEPT
[root@iruda ~]$etc/rc.d/init.d/iptables save
-bash: etc/rc.d/init.d/iptables: No such file or directory
[root@iruda ~]$/etc/rc.d/init.d/iptables save
iptables: Saving firewall rules to /etc/sysconfig/iptables:[ OK ]
[root@iruda ~]$mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.1.73 Source distribution
Copyright (c) 2000, 2013, 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> use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> update user set password=password('123123') where user='root';
Query OK, 3 rows affected (0.00 sec)
Rows matched: 3 Changed: 3 Warnings: 0
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> \q
Bye
[root@iruda ~]$service mysqld restart
Stopping mysqld: [ OK ]
Starting mysqld: [ OK ]
[root@iruda ~]$