环境:
OS:Linux As 5
mysql:5.6
1.下载跟OS相应的版本
[root@node2 soft]# uname -a
Linux node2 2.6.18-274.el5 #1 SMP Fri Jul 8 17:36:59 EDT 2011 x86_64 x86_64 x86_64 GNU/Linux
我这里是64位的linux,所有相应的下载64位的mysql
MySQL-5.6.19-1.rhel5.x86_64.rpm-bundle.tar
2.解压缩tar包
[root@node2 soft]# tar -xvf MySQL-5.6.19-1.rhel5.x86_64.rpm-bundle.tar
MySQL-client-5.6.19-1.rhel5.x86_64.rpm
MySQL-devel-5.6.19-1.rhel5.x86_64.rpm
MySQL-shared-compat-5.6.19-1.rhel5.x86_64.rpm
MySQL-embedded-5.6.19-1.rhel5.x86_64.rpm
MySQL-test-5.6.19-1.rhel5.x86_64.rpm
MySQL-shared-5.6.19-1.rhel5.x86_64.rpm
MySQL-server-5.6.19-1.rhel5.x86_64.rpm
加压缩后这里有好几个rpm包,其实我们只要安装如下两个包即可
MySQL-server-5.6.19-1.rhel5.x86_64.rpm
MySQL-client-5.6.19-1.rhel5.x86_64.rpm
3. 创建MySql系统管理用户
[root@node2 soft]# groupadd mysql
[root@node2 soft]# useradd -g mysql mysql
[root@node2 ~]# passwd mysql
Changing password for user mysql.
New UNIX password:
BAD PASSWORD: it is too short
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
4. 安装mysql rpm包
这里我们只安装如下两个包
MySQL-server-5.6.19-1.rhel5.x86_64.rpm
MySQL-client-5.6.19-1.rhel5.x86_64.rpm
查看rpm安装的路径,因为以后我们通过mysql账号管理mysql,所以需要将相应的目录属主赋予给mysql账号
[root@node2 soft]# rpm -pql MySQL-server-5.6.19-1.rhel5.x86_64.rpm
/etc/init.d/mysql
/etc/logrotate.d/mysql
/etc/my.cnf
/usr/bin/innochecksum
/usr/bin/my_print_defaults
/usr/bin/myisam_ftdump
/usr/bin/myisamchk
/usr/bin/myisamlog
/usr/bin/myisampack
/usr/bin/mysql_convert_table_format
/usr/bin/mysql_fix_extensions
/usr/bin/mysql_install_db
/usr/bin/mysql_plugin
/usr/bin/mysql_secure_installation
/usr/bin/mysql_setpermission
/usr/bin/mysql_tzinfo_to_sql
/usr/bin/mysql_upgrade
/usr/bin/mysql_zap
/usr/bin/mysqlbug
/usr/bin/mysqld_multi
/usr/bin/mysqld_safe
/usr/bin/mysqldumpslow
/usr/bin/mysqlhotcopy
/usr/bin/mysqltest
/usr/bin/perror
/usr/bin/replace
/usr/bin/resolve_stack_dump
/usr/bin/resolveip
/usr/lib64/mysql/libtcmalloc_minimal.so
/usr/lib64/mysql/plugin/adt_null.so
/usr/lib64/mysql/plugin/auth.so
/usr/lib64/mysql/plugin/auth_socket.so
/usr/lib64/mysql/plugin/auth_test_plugin.so
/usr/lib64/mysql/plugin/daemon_example.ini
/usr/lib64/mysql/plugin/debug/adt_null.so
/usr/lib64/mysql/plugin/debug/auth.so
/usr/lib64/mysql/plugin/debug/auth_socket.so
/usr/lib64/mysql/plugin/debug/auth_test_plugin.so
/usr/lib64/mysql/plugin/debug/innodb_engine.so
/usr/lib64/mysql/plugin/debug/libdaemon_example.so
/usr/lib64/mysql/plugin/debug/libmemcached.so
/usr/lib64/mysql/plugin/debug/mypluglib.so
/usr/lib64/mysql/plugin/debug/qa_auth_client.so
/usr/lib64/mysql/plugin/debug/qa_auth_interface.so
/usr/lib64/mysql/plugin/debug/qa_auth_server.so
/usr/lib64/mysql/plugin/debug/semisync_master.so
/usr/lib64/mysql/plugin/debug/semisync_slave.so
/usr/lib64/mysql/plugin/debug/validate_password.so
/usr/lib64/mysql/plugin/innodb_engine.so
/usr/lib64/mysql/plugin/libdaemon_example.so
/usr/lib64/mysql/plugin/libmemcached.so
/usr/lib64/mysql/plugin/mypluglib.so
/usr/lib64/mysql/plugin/qa_auth_client.so
/usr/lib64/mysql/plugin/qa_auth_interface.so
/usr/lib64/mysql/plugin/qa_auth_server.so
/usr/lib64/mysql/plugin/semisync_master.so
/usr/lib64/mysql/plugin/semisync_slave.so
/usr/lib64/mysql/plugin/validate_password.so
/usr/sbin/mysqld
/usr/sbin/mysqld-debug
/usr/sbin/rcmysql
/usr/share/doc/MySQL-server-5.6.19
/usr/share/doc/MySQL-server-5.6.19/COPYING
/usr/share/doc/MySQL-server-5.6.19/ChangeLog
/usr/share/doc/MySQL-server-5.6.19/INFO_BIN
/usr/share/doc/MySQL-server-5.6.19/INFO_SRC
/usr/share/doc/MySQL-server-5.6.19/README
/usr/share/doc/MySQL-server-5.6.19/my-default.cnf
/usr/share/man/man1/innochecksum.1.gz
/usr/share/man/man1/my_print_defaults.1.gz
/usr/share/man/man1/myisam_ftdump.1.gz
/usr/share/man/man1/myisamchk.1.gz
/usr/share/man/man1/myisamlog.1.gz
/usr/share/man/man1/myisampack.1.gz
/usr/share/man/man1/mysql.server.1.gz
/usr/share/man/man1/mysql_convert_table_format.1.gz
/usr/share/man/man1/mysql_fix_extensions.1.gz
/usr/share/man/man1/mysql_install_db.1.gz
/usr/share/man/man1/mysql_plugin.1.gz
/usr/share/man/man1/mysql_secure_installation.1.gz
/usr/share/man/man1/mysql_setpermission.1.gz
/usr/share/man/man1/mysql_tzinfo_to_sql.1.gz
/usr/share/man/man1/mysql_upgrade.1.gz
/usr/share/man/man1/mysql_zap.1.gz
/usr/share/man/man1/mysqlbug.1.gz
/usr/share/man/man1/mysqld_multi.1.gz
/usr/share/man/man1/mysqld_safe.1.gz
/usr/share/man/man1/mysqldumpslow.1.gz
/usr/share/man/man1/mysqlhotcopy.1.gz
/usr/share/man/man1/mysqlman.1.gz
/usr/share/man/man1/mysqltest.1.gz
/usr/share/man/man1/perror.1.gz
/usr/share/man/man1/replace.1.gz
/usr/share/man/man1/resolve_stack_dump.1.gz
/usr/share/man/man1/resolveip.1.gz
/usr/share/man/man8/mysqld.8.gz
/usr/share/mysql
/usr/share/mysql/SELinux
/usr/share/mysql/SELinux/RHEL4
/usr/share/mysql/SELinux/RHEL4/mysql.fc
/usr/share/mysql/SELinux/RHEL4/mysql.te
/usr/share/mysql/binary-configure
/usr/share/mysql/bulgarian
/usr/share/mysql/bulgarian/errmsg.sys
/usr/share/mysql/charsets
/usr/share/mysql/charsets/Index.xml
/usr/share/mysql/charsets/README
/usr/share/mysql/charsets/armscii8.xml
/usr/share/mysql/charsets/ascii.xml
/usr/share/mysql/charsets/cp1250.xml
/usr/share/mysql/charsets/cp1251.xml
/usr/share/mysql/charsets/cp1256.xml
/usr/share/mysql/charsets/cp1257.xml
/usr/share/mysql/charsets/cp850.xml
/usr/share/mysql/charsets/cp852.xml
/usr/share/mysql/charsets/cp866.xml
/usr/share/mysql/charsets/dec8.xml
/usr/share/mysql/charsets/geostd8.xml
/usr/share/mysql/charsets/greek.xml
/usr/share/mysql/charsets/hebrew.xml
/usr/share/mysql/charsets/hp8.xml
/usr/share/mysql/charsets/keybcs2.xml
/usr/share/mysql/charsets/koi8r.xml
/usr/share/mysql/charsets/koi8u.xml
/usr/share/mysql/charsets/latin1.xml
/usr/share/mysql/charsets/latin2.xml
/usr/share/mysql/charsets/latin5.xml
/usr/share/mysql/charsets/latin7.xml
/usr/share/mysql/charsets/macce.xml
/usr/share/mysql/charsets/macroman.xml
/usr/share/mysql/charsets/swe7.xml
/usr/share/mysql/czech
/usr/share/mysql/czech/errmsg.sys
/usr/share/mysql/danish
/usr/share/mysql/danish/errmsg.sys
/usr/share/mysql/dictionary.txt
/usr/share/mysql/dutch
/usr/share/mysql/dutch/errmsg.sys
/usr/share/mysql/english
/usr/share/mysql/english/errmsg.sys
/usr/share/mysql/errmsg-utf8.txt
/usr/share/mysql/estonian
/usr/share/mysql/estonian/errmsg.sys
/usr/share/mysql/fill_help_tables.sql
/usr/share/mysql/french
/usr/share/mysql/french/errmsg.sys
/usr/share/mysql/german
/usr/share/mysql/german/errmsg.sys
/usr/share/mysql/greek
/usr/share/mysql/greek/errmsg.sys
/usr/share/mysql/hungarian
/usr/share/mysql/hungarian/errmsg.sys
/usr/share/mysql/innodb_memcached_config.sql
/usr/share/mysql/italian
/usr/share/mysql/italian/errmsg.sys
/usr/share/mysql/japanese
/usr/share/mysql/japanese/errmsg.sys
/usr/share/mysql/korean
/usr/share/mysql/korean/errmsg.sys
/usr/share/mysql/magic
/usr/share/mysql/my-default.cnf
/usr/share/mysql/mysql-log-rotate
/usr/share/mysql/mysql.server
/usr/share/mysql/mysql_security_commands.sql
/usr/share/mysql/mysql_system_tables.sql
/usr/share/mysql/mysql_system_tables_data.sql
/usr/share/mysql/mysql_test_data_timezone.sql
/usr/share/mysql/mysqld_multi.server
/usr/share/mysql/norwegian
/usr/share/mysql/norwegian-ny
/usr/share/mysql/norwegian-ny/errmsg.sys
/usr/share/mysql/norwegian/errmsg.sys
/usr/share/mysql/polish
/usr/share/mysql/polish/errmsg.sys
/usr/share/mysql/portuguese
/usr/share/mysql/portuguese/errmsg.sys
/usr/share/mysql/romanian
/usr/share/mysql/romanian/errmsg.sys
/usr/share/mysql/russian
/usr/share/mysql/russian/errmsg.sys
/usr/share/mysql/serbian
/usr/share/mysql/serbian/errmsg.sys
/usr/share/mysql/slovak
/usr/share/mysql/slovak/errmsg.sys
/usr/share/mysql/spanish
/usr/share/mysql/spanish/errmsg.sys
/usr/share/mysql/swedish
/usr/share/mysql/swedish/errmsg.sys
/usr/share/mysql/ukrainian
/usr/share/mysql/ukrainian/errmsg.sys
[root@node2 soft]# rpm -qpl MySQL-client-5.6.19-1.rhel5.x86_64.rpm
/usr/bin/msql2mysql
/usr/bin/mysql
/usr/bin/mysql_config_editor
/usr/bin/mysql_find_rows
/usr/bin/mysql_waitpid
/usr/bin/mysqlaccess
/usr/bin/mysqlaccess.conf
/usr/bin/mysqladmin
/usr/bin/mysqlbinlog
/usr/bin/mysqlcheck
/usr/bin/mysqldump
/usr/bin/mysqlimport
/usr/bin/mysqlshow
/usr/bin/mysqlslap
/usr/share/man/man1/msql2mysql.1.gz
/usr/share/man/man1/mysql.1.gz
/usr/share/man/man1/mysql_config_editor.1.gz
/usr/share/man/man1/mysql_find_rows.1.gz
/usr/share/man/man1/mysql_waitpid.1.gz
/usr/share/man/man1/mysqlaccess.1.gz
/usr/share/man/man1/mysqladmin.1.gz
/usr/share/man/man1/mysqlbinlog.1.gz
/usr/share/man/man1/mysqlcheck.1.gz
/usr/share/man/man1/mysqldump.1.gz
/usr/share/man/man1/mysqlimport.1.gz
/usr/share/man/man1/mysqlshow.1.gz
/usr/share/man/man1/mysqlslap.1.gz
安装rpm包
[root@node2 soft]# rpm -ivh MySQL-server-5.6.19-1.rhel5.x86_64.rpm
Preparing... ########################################### [100%]
1:MySQL-server ########################################### [100%]
2014-07-29 11:30:06 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2014-07-29 11:30:06 12606 [Note] InnoDB: Using atomics to ref count buffer pool pages
2014-07-29 11:30:06 12606 [Note] InnoDB: The InnoDB memory heap is disabled
2014-07-29 11:30:06 12606 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2014-07-29 11:30:06 12606 [Note] InnoDB: Compressed tables use zlib 1.2.3
2014-07-29 11:30:06 12606 [Note] InnoDB: Using Linux native AIO
2014-07-29 11:30:06 12606 [Note] InnoDB: Not using CPU crc32 instructions
2014-07-29 11:30:06 12606 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2014-07-29 11:30:06 12606 [Note] InnoDB: Completed initialization of buffer pool
2014-07-29 11:30:06 12606 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!
2014-07-29 11:30:06 12606 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB
2014-07-29 11:30:06 12606 [Note] InnoDB: Database physically writes the file full: wait...
2014-07-29 11:30:08 12606 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB
2014-07-29 11:30:09 12606 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB
2014-07-29 11:30:10 12606 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
2014-07-29 11:30:10 12606 [Warning] InnoDB: New log files created, LSN=45781
2014-07-29 11:30:10 12606 [Note] InnoDB: Doublewrite buffer not found: creating new
2014-07-29 11:30:11 12606 [Note] InnoDB: Doublewrite buffer created
2014-07-29 11:30:11 12606 [Note] InnoDB: 128 rollback segment(s) are active.
2014-07-29 11:30:11 12606 [Warning] InnoDB: Creating foreign key constraint system tables.
2014-07-29 11:30:11 12606 [Note] InnoDB: Foreign key constraint system tables created
2014-07-29 11:30:11 12606 [Note] InnoDB: Creating tablespace and datafile system tables.
2014-07-29 11:30:11 12606 [Note] InnoDB: Tablespace and datafile system tables created.
2014-07-29 11:30:11 12606 [Note] InnoDB: Waiting for purge to start
2014-07-29 11:30:11 12606 [Note] InnoDB: 5.6.19 started; log sequence number 0
A random root password has been set. You will find it in '/root/.mysql_secret'.
2014-07-29 11:30:13 12606 [Note] Binlog end
2014-07-29 11:30:13 12606 [Note] InnoDB: FTS optimize thread exiting.
2014-07-29 11:30:13 12606 [Note] InnoDB: Starting shutdown...
2014-07-29 11:30:14 12606 [Note] InnoDB: Shutdown completed; log sequence number 1625977
2014-07-29 11:30:15 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2014-07-29 11:30:15 12630 [Note] InnoDB: Using atomics to ref count buffer pool pages
2014-07-29 11:30:15 12630 [Note] InnoDB: The InnoDB memory heap is disabled
2014-07-29 11:30:15 12630 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2014-07-29 11:30:15 12630 [Note] InnoDB: Compressed tables use zlib 1.2.3
2014-07-29 11:30:15 12630 [Note] InnoDB: Using Linux native AIO
2014-07-29 11:30:15 12630 [Note] InnoDB: Not using CPU crc32 instructions
2014-07-29 11:30:15 12630 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2014-07-29 11:30:15 12630 [Note] InnoDB: Completed initialization of buffer pool
2014-07-29 11:30:15 12630 [Note] InnoDB: Highest supported file format is Barracuda.
2014-07-29 11:30:15 12630 [Note] InnoDB: 128 rollback segment(s) are active.
2014-07-29 11:30:15 12630 [Note] InnoDB: Waiting for purge to start
2014-07-29 11:30:15 12630 [Note] InnoDB: 5.6.19 started; log sequence number 1625977
2014-07-29 11:30:15 12630 [Note] Binlog end
2014-07-29 11:30:15 12630 [Note] InnoDB: FTS optimize thread exiting.
2014-07-29 11:30:15 12630 [Note] InnoDB: Starting shutdown...
2014-07-29 11:30:17 12630 [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账号的随机密码保留在/root/.mysql_secret文件中,等会我们登陆的时候会用到这个随机密码.
[root@node2 soft]# rpm -ivh MySQL-client-5.6.19-1.rhel5.x86_64.rpm
Preparing... ########################################### [100%]
1:MySQL-client ########################################### [100%]
5.使用root用户登陆修改密码
获取root密码
[root@node2 soft]# more /root/.mysql_secret
# The random password set for the root user at Tue Jul 29 11:30:12 2014 (local time): fUKrlXCOc6iHiKKx
启动mysql
[root@node2 soft]# service mysql start
Starting MySQL.........................[ OK ]
[root@node2 soft]# mysql -h node2 -uroot -pfUKrlXCOc6iHiKKx
Warning: Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.6.19
Copyright (c) 2000, 2014, 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> set password=password('mysql');
Query OK, 0 rows affected (0.09 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.06 sec)
6. 修改安装目录权限
[root@node2 mysql]# chown -R mysql:mysql /usr/share/mysql
[root@node2 mysql]# chown -R mysql:mysql /var/lib/mysql
7. 为mysql添加环境变量
[mysql@node2 ~]$ more .bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin
export PATH
export LANG=zh_CN
export DATADIR=/var/lib/mysql
export MYSQL_HOME=/usr/share/mysql
8.停止启动mysql
停止mysql
[mysql@node2 ~]$ mysqladmin -h node2 -uroot -p shutdown
启动mysql
[mysql@node2 ~]$ /usr/share/mysql/mysql.server start --user=mysql
Starting MySQL...[ OK ]
或是
[mysql@node2 ~]$/usr/bin/mysqld_safe --user=mysql &
- 浏览: 37915 次
相关推荐
### Linux 下安装 MySQL 在 Linux 系统中安装 MySQL 数据库是一项常见的任务,尤其是在搭建 Web 服务器或开发环境中。本文将详细介绍如何在 Linux 系统上安装 MySQL,并提供相关的配置和管理指南。 #### 准备工作 ...
标题中的“Linux下安装Mysql”意味着我们将关注如何在Linux操作系统上安装MySQL数据库服务。这通常包括下载RPM包,验证依赖关系,然后进行安装。 描述中的“Linux mysql rpm安装包”指的是我们使用RPM包来安装MySQL...
Linux 下安装 MySQL 服务器 Linux 下安装 MySQL 服务器是指在 Linux 操作系统中安装和配置 MySQL 数据库服务器的过程。MySQL 是一种关系型数据库管理系统,广泛应用于 Web 应用程序中。 知识点: 1. 安装 MySQL ...
### Linux下安装MySQL 在Linux环境下安装MySQL是一个常见的任务,对于开发者、系统管理员以及数据库管理员而言至关重要。本文将详细介绍在Linux环境下安装MySQL的过程,并提供一些实用的技巧与建议。 #### 准备...
### Linux下安装MySQL详细步骤与知识点 #### 一、引言 在Linux环境下安装MySQL数据库是一项常见的任务,尤其是在CentOS这样的服务器操作系统上。本文将详细介绍如何在CentOS系统上安装MySQL,并解决安装过程中可能...
MySQL-server-community-5.1.60-1.rhel4.i386.rpm,linux下安装MySQL的安装包
### Linux下安装MySQL知识点详述 #### 一、下载与准备RPM包 在Linux环境下安装MySQL,首先需要获取MySQL的RPM包。RPM(Red Hat Package Manager)是一种用于管理软件包的工具,广泛应用于Red Hat Enterprise Linux...
Linux 下安装 MySQL Linux 是一个开源的操作系统, MySQL 是一个开源的关系数据库管理系统。在 Linux 系统中安装 MySQL 是一个非常重要的步骤。本文将一步步指导您如何在 Linux 系统中安装 MySQL。 查找以前是否...
【Linux下安装MySQL】 在Linux操作系统中安装MySQL数据库是一个必要的步骤,特别是在开发和管理Web应用程序时。本教程将详述如何在Linux环境下卸载旧版本的MySQL,以及如何正确安装和配置新版本的MySQL。 首先,...
### Linux下安装MySQL及基本操作 #### 一、安装MySQL 在Linux环境下安装MySQL数据库是一项常见但又重要的任务。本文将详细介绍如何在Linux系统中安装MySQL,并进行基本配置与操作。 ##### 1.1 检查系统是否已安装...
### Linux下安装MySQL数据库知识点详解 #### 一、前言 在Linux环境下安装MySQL数据库是一项常见但又较为复杂的任务,本文将详细介绍整个安装过程及注意事项,帮助读者顺利地完成安装。 #### 二、安装准备 1. **...
### 在Linux下安装MySQL的方法 #### 一、引言 随着Linux系统的广泛应用,越来越多的开发者开始选择在Linux环境下部署数据库应用。MySQL作为一款流行的关系型数据库管理系统,在Linux平台上的使用非常广泛。对于...