Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

MySQL 5.5.25 how to install and upgrade to 5.6.26 for RedHat Enterprise Linux 6.4 using rpm

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

Editor to share with you MySQL 5.5.25 how to use rpm to install and upgrade to 5.6.26 for RedHat Enterprise Linux 6.4, I hope you will learn something after reading this article, let's discuss it together!

Environment: RedHat Enterprise Linux 6.4 (x86 / 64) MySQL:5.6.25

RPM package installation method:

Step 1: preparatory work:

1. It is recommended to delete mysql users that exist in the system.

[root@mysql01 Desktop] # id mysql

Uid=27 (mysql) gid=27 (mysql) groups=27 (mysql)

[root@mysql01 Desktop] # userdel-r mysql

2. Clean up the installed mysql packages

[root@mysql01 Desktop] # service mysql status

[root@mysql01 Desktop] # service mysql stop

[root@mysql01 Desktop] # service mysql status

[root@suzzy ~] # rpm-qa | grep mysql

Mysql-server-5.1.66-2.el6_3.x86_64

Dovecot-mysql-2.0.9-5.el6.x86_64

Qt-mysql-4.6.2-25.el6.x86_64

Rsyslog-mysql-5.8.10-6.el6.x86_64

Mysql-5.1.66-2.el6_3.x86_64

Mod_auth_mysql-3.0.0-11.el6_0.1.x86_64

Mysql-devel-5.1.66-2.el6_3.x86_64

Mysql-libs-5.1.66-2.el6_3.x86_64

Use rpm-e to delete the installed mysql package. If you encounter an error that cannot be reported, you can not delete it. Add the parameter-- nodeps to force deletion.

For example:

[root@suzzy] # rpm-e qt-mysql-4.6.2-25.el6.x86_64

Error: Failed dependencies:

Qt4-mysql is needed by (installed) akonadi-1.2.1-2.el6.x86_64

[root@suzzy] # rpm-e qt-mysql-4.6.2-25.el6.x86_64-- nodeps

Rpm-e mysql-server-5.1.66-2.el6_3.x86_64-- nodeps

Rpm-e dovecot-mysql-2.0.9-5.el6.x86_64-- nodeps

Rpm-e qt-mysql-4.6.2-25.el6.x86_64-- nodeps

Rpm-e rsyslog-mysql-5.8.10-6.el6.x86_64-- nodeps

Rpm-e mysql-5.1.66-2.el6_3.x86_64-- nodeps

Rpm-e mod_auth_mysql-3.0.0-11.el6_0.1.x86_64-- nodeps

Rpm-e mysql-devel-5.1.66-2.el6_3.x86_64-- nodeps

Rpm-e mysql-libs-5.1.66-2.el6_3.x86_64-- nodeps

Until the mysql package is not found by executing the following statement

[root@mysql01 ~] # rpm-qa | grep mysql

Note: the configuration file / etc/my.cnf and the database file / var/lib/mysql need to be deleted after the uninstall is completed. For conservative reasons, the configuration file my.cnf can be renamed.

Step 2: start the installation

1. Set up user groups and users

[root@mysql01 ~] # groupadd mysql

[root@mysql01 ~] # useradd-g mysql mysql

2. Upload the downloaded rpm package of the mysql program to the server

Skip here

[root@mysql01 Desktop] # unzip V76360-01.zip

[root@mysql01 Desktop] # rpm-ivh MySQL-*

Preparing... # [100%]

1:MySQL-devel-advanced # [14%]

2:MySQL-client-advanced # [29%]

3:MySQL-test-advanced # [43%]

4:MySQL-embedded-advanced### [57%]

5:MySQL-shared-compat-adv### [71%]

6:MySQL-shared-advanced # [86%]

7:MySQL-server-advanced # # [100%]

2015-08-28 10:56:58 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use-explicit_defaults_for_timestamp server option (see documentation for more details).

2015-08-28 10:56:58 0 [Note] / usr/sbin/mysqld (mysqld 5.6.25-enterprise-commercial-advanced) starting as process 4981.

2015-08-28 10:56:58 4981 [Note] InnoDB: Using atomics to ref count buffer pool pages

2015-08-28 10:56:58 4981 [Note] InnoDB: The InnoDB memory heap is disabled

2015-08-28 10:56:58 4981 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins

2015-08-28 10:56:58 4981 [Note] InnoDB: Memory barrier is not used

2015-08-28 10:56:58 4981 [Note] InnoDB: Compressed tables use zlib 1.2.3

2015-08-28 10:56:58 4981 [Note] InnoDB: Using Linux native AIO

2015-08-28 10:56:58 4981 [Note] InnoDB: Using CPU crc32 instructions

2015-08-28 10:56:58 4981 [Note] InnoDB: Initializing buffer pool, size = 128.0m

2015-08-28 10:56:58 4981 [Note] InnoDB: Completed initialization of buffer pool

2015-08-28 10:56:58 4981 [Note] InnoDB: The first specified data file. / ibdata1 did not exist: a new database to be created!

2015-08-28 10:56:58 4981 [Note] InnoDB: Setting file. / ibdata1 size to 12 MB

2015-08-28 10:56:58 4981 [Note] InnoDB: Database physically writes the file full: wait...

2015-08-28 10:56:59 4981 [Note] InnoDB: Setting logfile. / ib_logfile101 size to 48 MB

2015-08-28 10:57:00 4981 [Note] InnoDB: Setting logfile. / ib_logfile1 size to 48 MB

2015-08-28 10:57:01 4981 [Note] InnoDB: Renaming logfile. / ib_logfile101 to. / ib_logfile0

2015-08-28 10:57:01 4981 [Warning] InnoDB: New log files created, LSN=45781

2015-08-28 10:57:01 4981 [Note] InnoDB: Doublewrite buffer not found: creating new

2015-08-28 10:57:01 4981 [Note] InnoDB: Doublewrite buffer created

2015-08-28 10:57:01 4981 [Note] InnoDB: 128rollback segment (s) are active.

2015-08-28 10:57:01 4981 [Warning] InnoDB: Creating foreign key constraint system tables.

2015-08-28 10:57:02 4981 [Note] InnoDB: Foreign key constraint system tables created

2015-08-28 10:57:02 4981 [Note] InnoDB: Creating tablespace and datafile system tables.

2015-08-28 10:57:02 4981 [Note] InnoDB: Tablespace and datafile system tables created.

2015-08-28 10:57:02 4981 [Note] InnoDB: Waiting for purge to start

2015-08-28 10:57:02 4981 [Note] InnoDB: 5.6.25 started; log sequence number 0

2015-08-28 10:57:02 4981 [Note] RSA private key file not found: / var/lib/mysql//private_key.pem. Some authentication plugins will not work.

2015-08-28 10:57:02 4981 [Note] RSA public key file not found: / var/lib/mysql//public_key.pem. Some authentication plugins will not work.

A random root password has been set. You will find it in'/ root/.mysql_secret'.

2015-08-28 10:57:03 4981 [Note] Binlog end

2015-08-28 10:57:03 4981 [Note] InnoDB: FTS optimize thread exiting.

2015-08-28 10:57:03 4981 [Note] InnoDB: Starting shutdown...

2015-08-28 10:57:04 4981 [Note] InnoDB: Shutdown completed; log sequence number 1625977

2015-08-28 10:57:04 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use-explicit_defaults_for_timestamp server option (see documentation for more details).

2015-08-28 10:57:04 0 [Note] / usr/sbin/mysqld (mysqld 5.6.25-enterprise-commercial-advanced) starting as process 5006.

2015-08-28 10:57:04 5006 [Note] InnoDB: Using atomics to ref count buffer pool pages

2015-08-28 10:57:04 5006 [Note] InnoDB: The InnoDB memory heap is disabled

2015-08-28 10:57:04 5006 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins

2015-08-28 10:57:04 5006 [Note] InnoDB: Memory barrier is not used

2015-08-28 10:57:04 5006 [Note] InnoDB: Compressed tables use zlib 1.2.3

2015-08-28 10:57:04 5006 [Note] InnoDB: Using Linux native AIO

2015-08-28 10:57:04 5006 [Note] InnoDB: Using CPU crc32 instructions

2015-08-28 10:57:04 5006 [Note] InnoDB: Initializing buffer pool, size = 128.0m

2015-08-28 10:57:04 5006 [Note] InnoDB: Completed initialization of buffer pool

2015-08-28 10:57:04 5006 [Note] InnoDB: Highest supported file format is Barracuda.

2015-08-28 10:57:04 5006 [Note] InnoDB: 128rollback segment (s) are active.

2015-08-28 10:57:04 5006 [Note] InnoDB: Waiting for purge to start

2015-08-28 10:57:04 5006 [Note] InnoDB: 5.6.25 started; log sequence number 1625977

2015-08-28 10:57:04 5006 [Note] RSA private key file not found: / var/lib/mysql//private_key.pem. Some authentication plugins will not work.

2015-08-28 10:57:04 5006 [Note] RSA public key file not found: / var/lib/mysql//public_key.pem. Some authentication plugins will not work.

2015-08-28 10:57:04 5006 [Note] Binlog end

2015-08-28 10:57:04 5006 [Note] InnoDB: FTS optimize thread exiting.

2015-08-28 10:57:04 5006 [Note] InnoDB: Starting shutdown...

2015-08-28 10:57:06 5006 [Note] InnoDB: Shutdown completed; log sequence number 1625987

A RANDOM PASSWORD HAS BEEN SET FOR THE MySQL root USER!

You will find that password in'/ root/.mysql_secret'.

You must change that password on your first connect

No other statement but 'SET PASSWORD' will be accepted.

See the manual for the semantics of the 'password expired' flag.

Also, the account for the anonymous user has been removed.

In addition, you can run:

/ usr/bin/mysql_secure_installation

Which will also give you the option of removing the test database.

This is strongly recommended for production servers.

See the manual for more instructions.

Please report any problems at http://bugs.mysql.com/

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

New default config file was created as / usr/my.cnf and

Will be used by default by the server when you start it.

You may edit this file to change server settings

[root@mysql01 Desktop] # cat / root/.mysql_secret

# The random password set for the root user at Fri Aug 28 10:57:02 2015 (local time): FY2X3PPff8VzaEn5

3. Configure and start mysql and set boot to start automatically.

[root@mysql01 Desktop] # cp / usr/share/mysql/my-default.cnf / etc/my.cnf

[root@mysql01 Desktop] # ls-l / etc/my.cnf

-rwxr-xr-x. 1 root root 1126 Aug 28 11:09 / etc/my.cnf

[root@mysql01 Desktop] # ps-ef | grep mysql

Root 5369 5167 0 11:10 pts/1 00:00:00 grep mysql

[root@mysql01 Desktop] # service mysql start

Starting MySQL.. [OK]

[root@mysql01 Desktop] # service mysql status

MySQL running (5507) [OK]

[root@mysql01 Desktop] # chkconfig-- list | grep mysql

Mysql 0:off 1:off 2:on 3:on 4:on 5:on 6:off

Note: if 2, 3 and 4 are off, that is, if mysql is not set to boot automatically, you can use the following method

[root@mysql01 Desktop] # chkconfig-- list | grep mysql

Mysql 0:off 1:off 2:off 3:off 4:off 5:off 6:off

[root@mysql01 Desktop] # chkconfig-- level 2345 mysql on

[root@mysql01 Desktop] # chkconfig-- list | grep mysql

Mysql 0:off 1:off 2:on 3:on 4:on 5:on 6:off

4. Log into the system:

[root@mysql01] # mysql-uroot-p

Enter password: / / password is empty

Welcome to the MySQL monitor. Commands end with; or\ g.

Your MySQL connection id is 13

Server version: 5.6.25-enterprise-commercial-advanced

Copyright (c) 2000, 2015, 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

ERROR 1820 (HY000): You must SET PASSWORD before executing this statement

Mysql > set password for root@'localhost'=password ("66666")

Query OK, 0 rows affected (0.10 sec)

Mysql > show databases

+-+

| | Database |

+-+

| | information_schema |

| | mysql |

| | performance_schema |

| | test |

+-+

4 rows in set (0.14 sec)

Mysql > exit

Bye

Note:

Before version 5.6 of MySQL, the database installed by default can be connected directly and requires a password. However, after entering version 5.6, the database administrator account (i.e. root) is built.

There will be password protection by default, and the initial password setting is also very strict, which also shows that after entering version 5.6, the security setting has been improved to a certain extent.

[root@mysql01] # mysql-uroot-p

Enter password:666666

Welcome to the MySQL monitor. Commands end with; or\ g.

Your MySQL connection id is 13

Server version: 5.6.25-enterprise-commercial-advanced

Copyright (c) 2000, 2015, 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 |

| | performance_schema |

| | test |

+-+

4 rows in set (0.14 sec)

Step 3: upgrade

Upgrade from MySQL 5.6.25 to 5.6.26

Upgrade installation:

1. Suspension of service

[root@mysql01 Desktop] # service mysql status

[root@mysql01 Desktop] # service mysql stop

[root@mysql01 Desktop] # service mysql status

2. Backup data files

[root@mysql01 Desktop] # mkdir / tmp/mbackup

[root@mysql01 Desktop] # cp / usr/my.cnf / tmp/mbackup-a

[root@mysql01 Desktop] # mkdir / tmp/mbackup/data

[root@mysql01 Desktop] # cp-rp / var/lib/mysql/* / tmp/mbackup/data

3. Unzip the installation source of the upgraded version

[root@mysql01 Desktop] # unzip V77245-01.zip

[root@mysql01 Desktop] # rpm-ivh MySQL-*-5.6.26-*-replacefiles

4. Update data dictionary after upgrade

[root@mysql01 Desktop] # service mysql status

MySQL is not running [FAILED]

[root@mysql01 Desktop] # service mysql start

Starting MySQL... [OK]

[root@mysql01 Desktop] # service mysql status

MySQL running (19134) [OK]

[root@mysql01 Desktop] # / usr/bin/mysql_upgrade-S / var/lib/mysql/mysql.sock-uroot-p666666 / / make sure the mysql service is started before operation

Warning: Using a password on the command line interface can be insecure.

Looking for 'mysql' as: / usr/bin/mysql

Looking for 'mysqlcheck' as: / usr/bin/mysqlcheck

Running 'mysqlcheck' with connection arguments:'-- socket=/var/lib/mysql/mysql.sock'

Warning: Using a password on the command line interface can be insecure.

Running 'mysqlcheck' with connection arguments:'-- socket=/var/lib/mysql/mysql.sock'

Warning: Using a password on the command line interface can be insecure.

Mysql.columns_priv OK

Mysql.db OK

Mysql.event OK

Mysql.func OK

Mysql.general_log OK

Mysql.help_category OK

Mysql.help_keyword OK

Mysql.help_relation OK

Mysql.help_topic OK

Mysql.innodb_index_stats OK

Mysql.innodb_table_stats OK

Mysql.ndb_binlog_index OK

Mysql.plugin OK

Mysql.proc OK

Mysql.procs_priv OK

Mysql.proxies_priv OK

Mysql.servers OK

Mysql.slave_master_info OK

Mysql.slave_relay_log_info OK

Mysql.slave_worker_info OK

Mysql.slow_log OK

Mysql.tables_priv OK

Mysql.time_zone OK

Mysql.time_zone_leap_second OK

Mysql.time_zone_name OK

Mysql.time_zone_transition OK

Mysql.time_zone_transition_type OK

Mysql.user OK

Running 'mysql_fix_privilege_tables'...

Warning: Using a password on the command line interface can be insecure.

Running 'mysqlcheck' with connection arguments:'-- socket=/var/lib/mysql/mysql.sock'

Warning: Using a password on the command line interface can be insecure.

Running 'mysqlcheck' with connection arguments:'-- socket=/var/lib/mysql/mysql.sock'

Warning: Using a password on the command line interface can be insecure.

OK

5. Check and confirm

[root@mysql01] # mysql-uroot-p

Enter password:666666

Welcome to the MySQL monitor. Commands end with; or\ g.

Your MySQL connection id is 13

Server version: 5.6.25-enterprise-commercial-advanced

Copyright (c) 2000, 2015, 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 > select version ()

+-+

| | version () |

+-+

| | 5.6.26-enterprise-commercial-advanced |

+-+

1 row in set (0.00 sec)

Mysql > show databases

+-+

| | Database |

+-+

| | information_schema |

| | mydata |

| | mysql |

| | performance_schema |

| | test |

| | test_db |

+-+

6 rows in set (0.00 sec)

After reading this article, I believe you have a certain understanding of "MySQL 5.5.25 how to use rpm to install and upgrade to 5.6.26 for RedHat Enterprise Linux 6.4". If you want to know more about it, you are welcome to follow the industry information channel. Thank you for reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report