MySQL5.5.25如何使用tar安装及升级到5.6.26forRedHatEnterpriseLinux6.4-成都创新互联网站建设

关于创新互联

多方位宣传企业产品与服务 突出企业形象

公司简介 公司的服务 荣誉资质 新闻动态 联系我们

MySQL5.5.25如何使用tar安装及升级到5.6.26forRedHatEnterpriseLinux6.4

这篇文章将为大家详细讲解有关MySQL 5.5.25如何使用tar安装及升级到5.6.26 for RedHat Enterprise Linux 6.4,小编觉得挺实用的,因此分享给大家做个参考,希望大家阅读完这篇文章后可以有所收获。

企业建站必须是能够以充分展现企业形象为主要目的,是企业文化与产品对外扩展宣传的重要窗口,一个合格的网站不仅仅能为公司带来巨大的互联网上的收集和信息发布平台,成都创新互联面向各种领域:三轮搅拌车网站设计成都全网营销解决方案、网站设计等建站排名服务。


步骤一:准备工作:
 
1、建议删除系统存在的mysql用户
[root@mysql01 Desktop]# id mysql
uid=27(mysql) gid=27(mysql) groups=27(mysql)
[root@mysql01 Desktop]# userdel -r mysql
 
2、清理已安装的mysql程序包
[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
 
使用rpm -e 包名 (都地上面显示)来清除安装包,如果碰到不能报错不能删除,加上参数 --nodeps强制删除即可。
例如:
[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
 
直到下面语句找不到mysql包为止
[root@mysql01 ~]# rpm -qa | grep mysql
 
注意:在卸载完成之后需要删除配置文件/etc/my.cnf和数据库文件/var/lib/mysql ,保守起见可将配置文件my.cnf进行改名处理。

步骤二:开始安装
 
1、建立用户组及用户
[root@mysql01 ~]# groupadd mysql
[root@mysql01 ~]# useradd -g mysql mysql
 
2、将下载好的mysql程序rpm包上传至服务器
此处略过
 
3. 解压缩mysql程序包
[root@mysql01 Desktop]# unzip V76366-01.zip
[root@mysql01 Desktop]# tar -zxvf mysql-advanced-5.6.22-linux-glibc2.5-x86_64.tar.gz
 
4. 将解压后的文件夹移动到/usr/local下并改名为mysql
[root@mysql01 Desktop]# mv mysql-advanced-5.6.25-linux-glibc2.5-x86_64 /usr/local/mysql
 
5. 建立mysql组,建立mysql用户并且加入到mysql组中
[root@mysql01 Desktop]# groupadd mysql
[root@mysql01 Desktop]# useradd mysql -g mysql
 
6. 复制my-default.cnf为my.cnf
[root@mysql01 Desktop]# cp /usr/share/mysql/my-default.cnf /etc/my.cnf
 
7. 初试化表并且规定用mysql用户来访问
[root@mysql01 Desktop]# cd /usr/local/mysql

[root@mysql01 mysql]# ./scripts/mysql_install_db --user=mysql
Installing MySQL system tables...2015-08-28 18:20:22 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 18:20:22 0 [Note] ./bin/mysqld (mysqld 5.6.25-enterprise-commercial-advanced) starting as process 10702 ...
2015-08-28 18:20:22 10702 [Note] InnoDB: Using atomics to ref count buffer pool pages
2015-08-28 18:20:22 10702 [Note] InnoDB: The InnoDB memory heap is disabled
2015-08-28 18:20:22 10702 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2015-08-28 18:20:22 10702 [Note] InnoDB: Memory barrier is not used
2015-08-28 18:20:22 10702 [Note] InnoDB: Compressed tables use zlib 1.2.3
2015-08-28 18:20:22 10702 [Note] InnoDB: Using Linux native AIO
2015-08-28 18:20:22 10702 [Note] InnoDB: Using CPU crc32 instructions
2015-08-28 18:20:22 10702 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2015-08-28 18:20:22 10702 [Note] InnoDB: Completed initialization of buffer pool
2015-08-28 18:20:22 10702 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!
2015-08-28 18:20:22 10702 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB
2015-08-28 18:20:22 10702 [Note] InnoDB: Database physically writes the file full: wait...
2015-08-28 18:20:22 10702 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB
2015-08-28 18:20:23 10702 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB
2015-08-28 18:20:24 10702 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
2015-08-28 18:20:24 10702 [Warning] InnoDB: New log files created, LSN=45781
2015-08-28 18:20:24 10702 [Note] InnoDB: Doublewrite buffer not found: creating new
2015-08-28 18:20:24 10702 [Note] InnoDB: Doublewrite buffer created
2015-08-28 18:20:24 10702 [Note] InnoDB: 128 rollback segment(s) are active.
2015-08-28 18:20:24 10702 [Warning] InnoDB: Creating foreign key constraint system tables.
2015-08-28 18:20:24 10702 [Note] InnoDB: Foreign key constraint system tables created
2015-08-28 18:20:24 10702 [Note] InnoDB: Creating tablespace and datafile system tables.
2015-08-28 18:20:24 10702 [Note] InnoDB: Tablespace and datafile system tables created.
2015-08-28 18:20:24 10702 [Note] InnoDB: Waiting for purge to start
2015-08-28 18:20:24 10702 [Note] InnoDB: 5.6.25 started; log sequence number 0
2015-08-28 18:20:24 10702 [Note] RSA private key file not found: /usr/local/mysql/data//private_key.pem. Some authentication plugins will not work.
2015-08-28 18:20:24 10702 [Note] RSA public key file not found: /usr/local/mysql/data//public_key.pem. Some authentication plugins will not work.
2015-08-28 18:20:25 10702 [Note] Binlog end
2015-08-28 18:20:25 10702 [Note] InnoDB: FTS optimize thread exiting.
2015-08-28 18:20:25 10702 [Note] InnoDB: Starting shutdown...
2015-08-28 18:20:26 10702 [Note] InnoDB: Shutdown completed; log sequence number 1625977
OK
 
Filling help tables...2015-08-28 18:20:26 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 18:20:26 0 [Note] ./bin/mysqld (mysqld 5.6.25-enterprise-commercial-advanced) starting as process 10725 ...
2015-08-28 18:20:26 10725 [Note] InnoDB: Using atomics to ref count buffer pool pages
2015-08-28 18:20:26 10725 [Note] InnoDB: The InnoDB memory heap is disabled
2015-08-28 18:20:26 10725 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2015-08-28 18:20:26 10725 [Note] InnoDB: Memory barrier is not used
2015-08-28 18:20:26 10725 [Note] InnoDB: Compressed tables use zlib 1.2.3
2015-08-28 18:20:26 10725 [Note] InnoDB: Using Linux native AIO
2015-08-28 18:20:26 10725 [Note] InnoDB: Using CPU crc32 instructions
2015-08-28 18:20:26 10725 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2015-08-28 18:20:26 10725 [Note] InnoDB: Completed initialization of buffer pool
2015-08-28 18:20:26 10725 [Note] InnoDB: Highest supported file format is Barracuda.
2015-08-28 18:20:26 10725 [Note] InnoDB: 128 rollback segment(s) are active.
2015-08-28 18:20:26 10725 [Note] InnoDB: Waiting for purge to start
2015-08-28 18:20:26 10725 [Note] InnoDB: 5.6.25 started; log sequence number 1625977
2015-08-28 18:20:26 10725 [Note] RSA private key file not found: /usr/local/mysql/data//private_key.pem. Some authentication plugins will not work.
2015-08-28 18:20:26 10725 [Note] RSA public key file not found: /usr/local/mysql/data//public_key.pem. Some authentication plugins will not work.
2015-08-28 18:20:27 10725 [Note] Binlog end
2015-08-28 18:20:27 10725 [Note] InnoDB: FTS optimize thread exiting.
2015-08-28 18:20:27 10725 [Note] InnoDB: Starting shutdown...
2015-08-28 18:20:28 10725 [Note] InnoDB: Shutdown completed; log sequence number 1625987
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:
 
  ./bin/mysqladmin -u root password 'new-password'
  ./bin/mysqladmin -u root -h mysql01 password 'new-password'
 
Alternatively you can run:
 
 ./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 . ; ./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 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 ./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 mysql]# cp /usr/share/mysql/my-default.cnf /etc/my.cnf
    
 
8. 设定用户访问权限与启动,登录测试
    
[root@mysql01 mysql]# chown -R root .
[root@mysql01 mysql]# chown -R mysql data
[root@mysql01 mysql]# bin/mysqld_safe --user=mysql &
[1] 10860
[root@mysql01 mysql]# 150828 18:25:13 mysqld_safe Logging to '/usr/local/mysql/data/mysql01.err'.
150828 18:25:14 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
[root@mysql01 mysql]# ps -ef | grep mysql
root    10860  3947  0 18:25 pts/0    00:00:00 /bin/sh bin/mysqld_safe --user=mysql
mysql    10962 10860  1 18:25 pts/0    00:00:00 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/usr/local/mysql/data/mysql01.err --pid-file=/usr/local/mysql/data/mysql01.pid
root    11007  3947  0 18:26 pts/0    00:00:00 grep mysql
 
[root@mysql01 ~]# mysql -uroot -p
Enter password:                       //密码为空
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("666666");
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


备注:

MySQL 5.6版本之前,默认安装的数据库是可以直接连接,五需密码的,而进入5.6版本,建库后数据库管理员账户(即root)
 
默认就会有密码保护,并且初始密码设置也很严格,这也说明进入5.6版本后,在安全性设置方面有一定提高


[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)
 
 
9. 将support-files目录下mysql.server复制到 /etc/init.d下,进行启动停止服务测试
[root@mysql01 mysql]# cp support-files/mysql.server /etc/init.d
[root@mysql01 mysql]# ls -l /etc/init.d/mysql.server
-rwxr-xr-x. 1 root root 10880 Aug 28 19:07 /etc/init.d/mysql.server
[root@mysql01 mysql]# /etc/init.d/mysql.server stop
Shutting down MySQL..150828 19:08:44 mysqld_safe mysqld from pid file /usr/local/mysql/data/mysql01.pid ended
                                                          [  OK  ]
[1]+  Done                   bin/mysqld_safe --user=mysql
[root@mysql01 mysql]# /etc/init.d/mysql.server start
Starting MySQL..                                          [  OK  ]
[root@mysql01 mysql]# /etc/init.d/mysql.server status
MySQL running (12316)                                     [  OK  ]
 
 
10. 设置环境变量中的PATH,这样就可以直接使用mysql相关命令

[root@mysql01 mysql]# vi ~/.bash_profile
PATH=$PATH:$HOME/bin:/usr/local/mysql/bin
[root@mysql01 ~]# source /root/.bash_profile
或者:
[root@mysql01 ~]# . .bash_profile

[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)

关于“MySQL 5.5.25如何使用tar安装及升级到5.6.26 for RedHat Enterprise Linux 6.4”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,使各位可以学到更多知识,如果觉得文章不错,请把它分享出去让更多的人看到。


本文题目:MySQL5.5.25如何使用tar安装及升级到5.6.26forRedHatEnterpriseLinux6.4
文章链接:http://kswsj.cn/article/ijdpii.html

其他资讯