Linux环境MySQL5.6安装实录

MySQL的安装相对于Oracle来说非常简单,个人觉得与TimesTen的安装配置更为接近,而且后面的Master-Slave或Master-Master集群配置更为简单,甚至比TimesTen的ASP/Active-Active/Active-Standby配置都比TimesTen还要简单,不过MySQL涉及的初始化参数还是比较多,初始化参数配置不合理MySQL将很难启动,这次安装MySQL感觉比十年前第一次安装Oracle RAC还折腾,百度了一圈感觉网上的步骤清晰一点的都是使用cmake这个包来安装,所以这里纪录一下安装步骤,或许有对初次接触MySQL的兄弟会有帮助。

安装步骤:
1、安装MySQL数据库软件rpm包
2、配置MySQL数据库参数文件my.cnf
3、初始化MySQL数据库实例
4、启动MySQL服务进程mysqld
5、修改登录密码和检查数据库参数

一、操作系统环境
IP:192.168.100.71 tony7
操作系统版本:
  # uname -a
Linux tony7 2.6.32-71.el6.x86_64 #1 SMP Wed Sep 1 01:33:01 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux
 
# free -g
            total      used      free    shared    buffers    cached
Mem:            1          0          1          0          0          0
-/+ buffers/cache:          0          1
Swap:            3          0          3

df -h

# rpm -qa|grep -i mysql
mysql-5.1.47-4.el6.x86_64
perl-DBD-MySQL-4.013-3.el6.x86_64
mysql-libs-5.1.47-4.el6.x86_64
qt-mysql-4.6.2-16.el6.x86_64
mysql-server-5.1.47-4.el6.x86_64

[root@tony7 soft]# rpm -e --nodeps mysql-5.1.47-4.el6.x86_64
[root@tony7 soft]# rpm -e --nodeps perl-DBD-MySQL-4.013-3.el6.x86_64
[root@tony7 soft]# rpm -e --nodeps mysql-libs-5.1.47-4.el6.x86_64
[root@tony7 soft]# rpm -e --nodeps qt-mysql-4.6.2-16.el6.x86_64
[root@tony7 soft]# rpm -e --nodeps mysql-server-5.1.47-4.el6.x86_64
如果已安装,则需要删除已安装的数据库,使用以下命令来删除数据库
删除命令:rpm -e --nodeps 包名
( rpm -ev mysql-4.1.12-3.RHEL4.1 )
删除老版本mysql的开发头文件和库
命令:rm -fr /usr/lib/mysql
rm -fr /usr/include/mysql
注意:卸载后/var/lib/mysql中的数据及/etc/my.cnf不会删除,如果确定没用后就手工删除
rm -f /etc/my.cnf
rm -fr /var/lib/mysql

二、安装数据库软件
    MySQL-server-5.6.28-1.el6.x86_64.rpm
    MySQL-client-5.6.28-1.el6.x86_64.rpm
    MySQL-devel-5.6.28-1.el6.x86_64.rpm
   
# rpm -ivh MySQL-server-5.6.28-1.el6.x86_64.rpm
warning: MySQL-server-5.6.28-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                ########################################### [100%]
  1:MySQL-server          ########################################### [100%]
2016-01-18 14:42:21 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2016-01-18 14:42:21 0 [Note] /usr/sbin/mysqld (mysqld 5.6.28) starting as process 1671 ...
2016-01-18 14:42:21 1671 [Note] InnoDB: Using atomics to ref count buffer pool pages
2016-01-18 14:42:21 1671 [Note] InnoDB: The InnoDB memory heap is disabled
2016-01-18 14:42:21 1671 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2016-01-18 14:42:21 1671 [Note] InnoDB: Memory barrier is not used
2016-01-18 14:42:21 1671 [Note] InnoDB: Compressed tables use zlib 1.2.3
2016-01-18 14:42:21 1671 [Note] InnoDB: Using Linux native AIO
2016-01-18 14:42:21 1671 [Note] InnoDB: Using CPU crc32 instructions
2016-01-18 14:42:21 1671 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2016-01-18 14:42:21 1671 [Note] InnoDB: Completed initialization of buffer pool
2016-01-18 14:42:21 1671 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!
2016-01-18 14:42:21 1671 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB
2016-01-18 14:42:21 1671 [Note] InnoDB: Database physically writes the file full: wait...
2016-01-18 14:42:21 1671 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB
2016-01-18 14:42:22 1671 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB
2016-01-18 14:42:22 1671 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
2016-01-18 14:42:22 1671 [Warning] InnoDB: New log files created, LSN=45781
2016-01-18 14:42:22 1671 [Note] InnoDB: Doublewrite buffer not found: creating new
2016-01-18 14:42:22 1671 [Note] InnoDB: Doublewrite buffer created
2016-01-18 14:42:22 1671 [Note] InnoDB: 128 rollback segment(s) are active.
2016-01-18 14:42:22 1671 [Warning] InnoDB: Creating foreign key constraint system tables.
2016-01-18 14:42:22 1671 [Note] InnoDB: Foreign key constraint system tables created
2016-01-18 14:42:22 1671 [Note] InnoDB: Creating tablespace and datafile system tables.
2016-01-18 14:42:22 1671 [Note] InnoDB: Tablespace and datafile system tables created.
2016-01-18 14:42:22 1671 [Note] InnoDB: Waiting for purge to start
2016-01-18 14:42:22 1671 [Note] InnoDB: 5.6.28 started; log sequence number 0
A random root password has been set. You will find it in '/root/.mysql_secret'.
2016-01-18 14:42:22 1671 [Note] Binlog end
2016-01-18 14:42:22 1671 [Note] InnoDB: FTS optimize thread exiting.
2016-01-18 14:42:22 1671 [Note] InnoDB: Starting shutdown...
2016-01-18 14:42:24 1671 [Note] InnoDB: Shutdown completed; log sequence number 1625977

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/33355b3282ea856eb4bd2b7c1efff9d9.html