大橙子网站建设,新征程启航
为企业提供网站建设、域名注册、服务器等服务
一、安装环境
从网站建设到定制行业解决方案,为提供成都网站制作、成都网站设计、外贸营销网站建设服务体系,各种行业企业客户提供网站建设解决方案,助力业务快速发展。成都创新互联将不断加快创新步伐,提供优质的建站服务。1、操作系统版本:Red Hat Enterprise Linux Server release 6.5 (Santiago)
2、Mysql版本:MySQL-5.6.38-1.el6.x86_64.rpm-bundle.tar
二、安装说明
网上不少资料在使用rpm包安装Mysql 5.6之前,都会先卸载系统自带的mysql-libs,但有的资料是用yum remove mysql,但这样会把依赖mysql-libs的8个包也一同卸载,其中就包括postfix、crontab等软件包,造成了非预期目的的卸载,有的资料就使用rpm -e --nodeps mysql-libs来避免卸载其他依赖mysql-libs的软件包,但是也并非完全正确的做法,Mysql官方提供的Mysql-shared-compat正是替代mysql-libs的rpm包,应先安装此包,再单独卸载mysql-libs,官方说明如下:
解压MySQL-5.6.38-1.el6.x86_64.rpm-bundle.tar后,可以看到包含了多个rpm包文件
网上不少资料都选择了安装Mysql-server、Mysql-client和Mysql-devel三个包,但实际上Mysql-devel的作用是如果需要编译其他mysql客户端例如perl mysql模块或者打算编译C API应用程序,实际上大多数情况下标准安装并不需要安装Mysql-devel,只需要按照Mysql-server和Mysql-client就行,本文就是这样安装。官网的介绍如下:
三、安装过程
1、首先安装一下Mysql-shared-compat,再单独卸载mysql-libs。
2、安装mysql-server,根据提示安装完成后的随机密码在/root/.mysql_secret,并且可以运行安全配置向导/usr/bin/mysql_secure_installation,还有配置文件在/usr/my.cnf(按习惯一般拷贝到/etc/my.cnf)
[root@node01 mysqlrpm]# rpm -ivh MySQL-server-5.6.38-1.el6.x86_64.rpm warning: MySQL-server-5.6.38-1.el6.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY Preparing... ########################################### [100%] 1:MySQL-server ########################################### [100%] warning: user mysql does not exist - using root warning: group mysql does not exist - using root warning: user mysql does not exist - using root warning: group mysql does not exist - using root 2017-10-28 20:57:24 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2017-10-28 20:57:24 0 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap. 2017-10-28 20:57:24 0 [Note] /usr/sbin/mysqld (mysqld 5.6.38) starting as process 8869 ... 2017-10-28 20:57:24 8869 [Note] InnoDB: Using atomics to ref count buffer pool pages 2017-10-28 20:57:24 8869 [Note] InnoDB: The InnoDB memory heap is disabled 2017-10-28 20:57:24 8869 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins 2017-10-28 20:57:24 8869 [Note] InnoDB: Memory barrier is not used 2017-10-28 20:57:24 8869 [Note] InnoDB: Compressed tables use zlib 1.2.3 2017-10-28 20:57:24 8869 [Note] InnoDB: Using Linux native AIO 2017-10-28 20:57:24 8869 [Note] InnoDB: Using CPU crc32 instructions 2017-10-28 20:57:24 8869 [Note] InnoDB: Initializing buffer pool, size = 128.0M 2017-10-28 20:57:24 8869 [Note] InnoDB: Completed initialization of buffer pool 2017-10-28 20:57:24 8869 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created! 2017-10-28 20:57:24 8869 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB 2017-10-28 20:57:24 8869 [Note] InnoDB: Database physically writes the file full: wait... 2017-10-28 20:57:25 8869 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB 2017-10-28 20:57:26 8869 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB 2017-10-28 20:57:27 8869 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0 2017-10-28 20:57:27 8869 [Warning] InnoDB: New log files created, LSN=45781 2017-10-28 20:57:27 8869 [Note] InnoDB: Doublewrite buffer not found: creating new 2017-10-28 20:57:27 8869 [Note] InnoDB: Doublewrite buffer created 2017-10-28 20:57:27 8869 [Note] InnoDB: 128 rollback segment(s) are active. 2017-10-28 20:57:27 8869 [Warning] InnoDB: Creating foreign key constraint system tables. 2017-10-28 20:57:27 8869 [Note] InnoDB: Foreign key constraint system tables created 2017-10-28 20:57:27 8869 [Note] InnoDB: Creating tablespace and datafile system tables. 2017-10-28 20:57:27 8869 [Note] InnoDB: Tablespace and datafile system tables created. 2017-10-28 20:57:27 8869 [Note] InnoDB: Waiting for purge to start 2017-10-28 20:57:27 8869 [Note] InnoDB: 5.6.38 started; log sequence number 0 A random root password has been set. You will find it in '/root/.mysql_secret'. 2017-10-28 20:57:28 8869 [Note] Binlog end 2017-10-28 20:57:28 8869 [Note] InnoDB: FTS optimize thread exiting. 2017-10-28 20:57:28 8869 [Note] InnoDB: Starting shutdown... 2017-10-28 20:57:29 8869 [Note] InnoDB: Shutdown completed; log sequence number 1625977 2017-10-28 20:57:29 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2017-10-28 20:57:29 0 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap. 2017-10-28 20:57:29 0 [Note] /usr/sbin/mysqld (mysqld 5.6.38) starting as process 8891 ... 2017-10-28 20:57:29 8891 [Note] InnoDB: Using atomics to ref count buffer pool pages 2017-10-28 20:57:29 8891 [Note] InnoDB: The InnoDB memory heap is disabled 2017-10-28 20:57:29 8891 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins 2017-10-28 20:57:29 8891 [Note] InnoDB: Memory barrier is not used 2017-10-28 20:57:29 8891 [Note] InnoDB: Compressed tables use zlib 1.2.3 2017-10-28 20:57:29 8891 [Note] InnoDB: Using Linux native AIO 2017-10-28 20:57:29 8891 [Note] InnoDB: Using CPU crc32 instructions 2017-10-28 20:57:29 8891 [Note] InnoDB: Initializing buffer pool, size = 128.0M 2017-10-28 20:57:29 8891 [Note] InnoDB: Completed initialization of buffer pool 2017-10-28 20:57:29 8891 [Note] InnoDB: Highest supported file format is Barracuda. 2017-10-28 20:57:29 8891 [Note] InnoDB: 128 rollback segment(s) are active. 2017-10-28 20:57:29 8891 [Note] InnoDB: Waiting for purge to start 2017-10-28 20:57:29 8891 [Note] InnoDB: 5.6.38 started; log sequence number 1625977 2017-10-28 20:57:29 8891 [Note] Binlog end 2017-10-28 20:57:29 8891 [Note] InnoDB: FTS optimize thread exiting. 2017-10-28 20:57:29 8891 [Note] InnoDB: Starting shutdown... 2017-10-28 20:57:31 8891 [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 settings3、安装Mysql-client
4、复制my.conf并启动服务
[root@node01 mysqlrpm]# cp /usr/my.cnf /etc/my.cnf
5、RPM包安装后的目录结构如下:
四、初始化配置Mysql并登录数据库
1、网上很多资料在RPM安装完Mysql 5.6后还执行了/usr/bin/mysql_install_db进行初始化安装但安全配置向导却没运行,实际上在Mysql 5.6.8开始,用RPM包全新安装时会调用/usr/bin/mysql_install_db并带上随机密码参数,因此并不需要再执行mysql_install_db,反而运行安全配置向导很有必要。官网说明如下:
2、运行安全配置向导,由于需要输入root密码,因此先查看一下随机生成的密码文件。
[root@node01 ~]# cat /root/.mysql_secret # The random password set for the root user at Sat Oct 28 20:57:28 2017 (local time): LyE_R5rVp7p1vLMe安全配置向导主要执行以下操作:
a)是否为root用户设置密码
b)是否删除匿名账号
c)是否取消root用户远程登录
d)是否删除test库和对test库的访问权限
e)是否刷新授权表使修改生效
3、登录数据库,确认安装成功完成
另外有需要云服务器可以了解下创新互联cdcxhl.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。