search
HomeDatabaseMysql TutorialMySQL 5.6.19 二进制的装配方式

MySQL 5.6.19 二进制的安装方式 1.操作系统 CentOS release 6.2 (Final) 2.创建用户和组 [root@mymaster1 ~]# groupadd mysql [root@mymaster1 ~]# useradd -r -g mysqlmysql 3.解压安装包(解压到你想存储数据库数据的地方) [root@mymaster1 ~]# cd /data [

MySQL 5.6.19 二进制的安装方式

1.        操作系统

CentOS release 6.2 (Final)

 

2.        创建用户和组

[root@mymaster1 ~]# groupadd mysql

[root@mymaster1 ~]# useradd -r -g mysqlmysql

 

3.        解压安装包(解压到你想存储数据库数据的地方)

[root@mymaster1 ~]# cd /data

[root@mymaster1 data]# tar -xzvf /root/mysql_soft/mysql-5.6.19-linux-glibc2.5-x86_64.tar.gz

[root@mymaster1 data]# ln -s mysql-5.6.19-linux-glibc2.5-x86_64 mysql

 

4.        查看解压情况

[root@mymaster1 data]# ll

总用量 20

lrwxrwxrwx.  1 root root   34  6 27 15:31 mysql -> mysql-5.6.19-linux-glibc2.5-x86_64

drwxr-xr-x. 13 rootroot  4096  6 27 15:31 mysql-5.6.19-linux-glibc2.5-x86_64

 

5.        修改文件夹所属用户和组为mysql:

[root@mymaster1 data]# cd mysql

[root@mymaster1 mysql]# chown -R mysql:mysql .

 

6.        安装数据库,数据存放目录为/data/mysql/data

[root@mymaster1 mysql]#scripts/mysql_install_db --user=mysql --basedir=/data/mysql --datadir=/data/mysql/data

WARNING: The host'mymaster1.localdomain' could not be looked up with /data/mysql/bin/resolveip.

This probably means thatyour libc libraries are not 100 % compatible

with this binary MySQLversion. The MySQL daemon, mysqld, should work

normally with the exceptionthat host name resolving will not work.

This means that youshould use IP addresses instead of hostnames

when specifying MySQLprivileges !

 

当出现上面警告时,解决方法是:在/etc/hosts配置文件中增加IP地址和主机名的映射

[root@mymaster1 Packages]# cat /etc/hosts

127.0.0.1  localhost localhost.localdomain localhost4 localhost4.localdomain4

::1        localhost localhost.localdomain localhost6 localhost6.localdomain6

IP地址  mymaster1.localdomain

 

正确的提示信息如下:

[root@mymaster1 mysql]#scripts/mysql_install_db --user=mysql --basedir=/data/mysql --datadir=/data/mysql/data

Installing MySQL system tables...2014-06-2716:02:45 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated.Please use --explicit_defaults_for_timestamp server option (see documentationfor more details).

2014-06-27 16:02:45 2134 [Note] InnoDB:Using atomics to ref count buffer pool pages

2014-06-27 16:02:45 2134 [Note] InnoDB: TheInnoDB memory heap is disabled

2014-06-27 16:02:45 2134 [Note] InnoDB:Mutexes and rw_locks use GCC atomic builtins

2014-06-27 16:02:45 2134 [Note] InnoDB:Compressed tables use zlib 1.2.3

2014-06-27 16:02:45 2134 [Note] InnoDB:Using Linux native AIO

2014-06-27 16:02:45 2134 [Note] InnoDB:Using CPU crc32 instructions

2014-06-27 16:02:45 2134 [Note] InnoDB:Initializing buffer pool, size = 128.0M

2014-06-27 16:02:45 2134 [Note] InnoDB:Completed initialization of buffer pool

2014-06-27 16:02:45 2134 [Note] InnoDB: Thefirst specified data file ./ibdata1 did not exist: a new database to becreated!

2014-06-27 16:02:45 2134 [Note] InnoDB:Setting file ./ibdata1 size to 12 MB

2014-06-27 16:02:45 2134 [Note] InnoDB:Database physically writes the file full: wait...

2014-06-27 16:02:45 2134 [Note] InnoDB:Setting log file ./ib_logfile101 size to 48 MB

2014-06-27 16:02:46 2134 [Note] InnoDB:Setting log file ./ib_logfile1 size to 48 MB

2014-06-27 16:02:46 2134 [Note] InnoDB:Renaming log file ./ib_logfile101 to ./ib_logfile0

2014-06-27 16:02:46 2134 [Warning] InnoDB:New log files created, LSN=45781

2014-06-27 16:02:46 2134 [Note] InnoDB:Doublewrite buffer not found: creating new

2014-06-27 16:02:46 2134 [Note] InnoDB:Doublewrite buffer created

2014-06-27 16:02:46 2134 [Note] InnoDB: 128rollback segment(s) are active.

2014-06-27 16:02:46 2134 [Warning] InnoDB:Creating foreign key constraint system tables.

2014-06-27 16:02:46 2134 [Note] InnoDB:Foreign key constraint system tables created

2014-06-27 16:02:46 2134 [Note] InnoDB:Creating tablespace and datafile system tables.

2014-06-27 16:02:46 2134 [Note] InnoDB:Tablespace and datafile system tables created.

2014-06-27 16:02:46 2134 [Note] InnoDB:Waiting for purge to start

2014-06-27 16:02:46 2134 [Note] InnoDB:5.6.19 started; log sequence number 0

2014-06-27 16:02:47 2134 [Note] Binlog end

2014-06-27 16:02:47 2134 [Note] InnoDB: FTSoptimize thread exiting.

2014-06-27 16:02:47 2134 [Note] InnoDB:Starting shutdown...

2014-06-27 16:02:48 2134 [Note] InnoDB:Shutdown completed; log sequence number 1625977

OK

 

Filling help tables...2014-06-27 16:02:48 0[Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use--explicit_defaults_for_timestamp server option (see documentation for moredetails).

2014-06-27 16:02:48 2157 [Note] InnoDB:Using atomics to ref count buffer pool pages

2014-06-27 16:02:48 2157 [Note] InnoDB: TheInnoDB memory heap is disabled

2014-06-27 16:02:48 2157 [Note] InnoDB:Mutexes and rw_locks use GCC atomic builtins

2014-06-27 16:02:48 2157 [Note] InnoDB:Compressed tables use zlib 1.2.3

2014-06-27 16:02:48 2157 [Note] InnoDB:Using Linux native AIO

2014-06-27 16:02:48 2157 [Note] InnoDB:Using CPU crc32 instructions

2014-06-27 16:02:48 2157 [Note] InnoDB:Initializing buffer pool, size = 128.0M

2014-06-27 16:02:48 2157 [Note] InnoDB:Completed initialization of buffer pool

2014-06-27 16:02:48 2157 [Note] InnoDB:Highest supported file format is Barracuda.

2014-06-27 16:02:48 2157 [Note] InnoDB: 128rollback segment(s) are active.

2014-06-27 16:02:48 2157 [Note] InnoDB:Waiting for purge to start

2014-06-27 16:02:48 2157 [Note] InnoDB:5.6.19 started; log sequence number 1625977

2014-06-27 16:02:48 2157 [Note] Binlog end

2014-06-27 16:02:48 2157 [Note] InnoDB: FTSoptimize thread exiting.

2014-06-27 16:02:48 2157 [Note] InnoDB: Startingshutdown...

2014-06-27 16:02:50 2157 [Note] InnoDB:Shutdown completed; log sequence number 1625987

OK

 

To start mysqld at boot time you have tocopy

support-files/mysql.server to the rightplace for your system

 

PLEASE REMEMBER TO SET A PASSWORD FOR THEMySQL root USER !

To do so, start the server, then issue thefollowing commands:

 

 /data/mysql/bin/mysqladmin -u root password 'new-password'

 /data/mysql/bin/mysqladmin -u root -h mymaster1.localdomain password'new-password'

 

Alternatively you can run:

 

 /data/mysql/bin/mysql_secure_installation

 

which will also give you the option ofremoving the test

databases and anonymous user created bydefault.  This is

strongly recommended for productionservers.

 

See the manual for more instructions.

 

You can start the MySQL daemon with:

 

  cd. ; /data/mysql/bin/mysqld_safe &

 

You can test the MySQL daemon withmysql-test-run.pl

 

  cdmysql-test ; perl mysql-test-run.pl

 

Please report any problems athttp://bugs.mysql.com/

 

The latest information about MySQL isavailable on the web at

 

 http://www.mysql.com

 

Support MySQL by buying support/licenses athttp://shop.mysql.com

 

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

will be used by default by the server whenyou start it.

You may edit this file to change serversettings

 

7.        修改相关目录权限,提高安全性:

[root@mymaster1 mysql]# chown -R root .

[root@mymaster1 mysql]# chown -R mysql data

 

8.        配置MySQL服务为主机服务,即能用service mysql start启动服务

[root@mymaster1 mysql]# cpsupport-files/mysql.server /etc/init.d/mysql

[root@mymaster1 mysql]# vi /etc/init.d/mysql

把下面的

basedir=

datadir=

修改为

basedir=/data/mysql

datadir=/data/mysql/data

 

9.        启动数据库

[root@mymaster1 mysql]# service mysql start

Starting MySQL[确定]

 

10.    修改数据库root密码

[root@mymaster1 mysql]#/data/mysql/bin/mysqladmin -u root password 'wengjixi'

[root@mymaster1 mysql]#/data/mysql/bin/mysqladmin -u root -h mymaster1.localdomain password 'wengjixi'

 

11.    修改环境变量,把mysql执行文件路径添加到环境变量中

[root@mymaster1 mysql]# vi /etc/profile

PATH=$PATH:/data/mysql/bin

export PATH


[root@mymaster1 mysql]# source /etc/profile

 

12.    测试登录

[root@mymaster1 mysql]# mysql -u root -p

Enter password:

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

Your MySQL connection id is 5

Server version: 5.6.19 MySQL CommunityServer (GPL)

 

Copyright (c) 2000, 2014, Oracle and/or itsaffiliates. All rights reserved.

 

Oracle is a registered trademark of OracleCorporation and/or its

affiliates. Other names may be trademarksof their respective

owners.

 

Type 'help;' or '\h' for help. Type '\c' toclear the current input statement.

 

mysql>

 

mysql> show variables like '%data%';

+-------------------------------+------------------------+

| Variable_name                 | Value                  |

+-------------------------------+------------------------+

| character_set_database        | latin1                 |

| collation_database            | latin1_swedish_ci      |

| datadir                       | /data/mysql/data/ 

 

 

 

 

 

 

 

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
图文详解mysql架构原理图文详解mysql架构原理May 17, 2022 pm 05:54 PM

本篇文章给大家带来了关于mysql的相关知识,其中主要介绍了关于架构原理的相关内容,MySQL Server架构自顶向下大致可以分网络连接层、服务层、存储引擎层和系统文件层,下面一起来看一下,希望对大家有帮助。

mysql怎么去掉第一个字符mysql怎么去掉第一个字符May 19, 2022 am 10:21 AM

方法:1、利用right函数,语法为“update 表名 set 指定字段 = right(指定字段, length(指定字段)-1)...”;2、利用substring函数,语法为“select substring(指定字段,2)..”。

mysql的msi与zip版本有什么区别mysql的msi与zip版本有什么区别May 16, 2022 pm 04:33 PM

mysql的msi与zip版本的区别:1、zip包含的安装程序是一种主动安装,而msi包含的是被installer所用的安装文件以提交请求的方式安装;2、zip是一种数据压缩和文档存储的文件格式,msi是微软格式的安装包。

mysql怎么替换换行符mysql怎么替换换行符Apr 18, 2022 pm 03:14 PM

在mysql中,可以利用char()和REPLACE()函数来替换换行符;REPLACE()函数可以用新字符串替换列中的换行符,而换行符可使用“char(13)”来表示,语法为“replace(字段名,char(13),'新字符串') ”。

mysql怎么将varchar转换为int类型mysql怎么将varchar转换为int类型May 12, 2022 pm 04:51 PM

转换方法:1、利用cast函数,语法“select * from 表名 order by cast(字段名 as SIGNED)”;2、利用“select * from 表名 order by CONVERT(字段名,SIGNED)”语句。

MySQL复制技术之异步复制和半同步复制MySQL复制技术之异步复制和半同步复制Apr 25, 2022 pm 07:21 PM

本篇文章给大家带来了关于mysql的相关知识,其中主要介绍了关于MySQL复制技术的相关问题,包括了异步复制、半同步复制等等内容,下面一起来看一下,希望对大家有帮助。

带你把MySQL索引吃透了带你把MySQL索引吃透了Apr 22, 2022 am 11:48 AM

本篇文章给大家带来了关于mysql的相关知识,其中主要介绍了mysql高级篇的一些问题,包括了索引是什么、索引底层实现等等问题,下面一起来看一下,希望对大家有帮助。

mysql怎么判断是否是数字类型mysql怎么判断是否是数字类型May 16, 2022 am 10:09 AM

在mysql中,可以利用REGEXP运算符判断数据是否是数字类型,语法为“String REGEXP '[^0-9.]'”;该运算符是正则表达式的缩写,若数据字符中含有数字时,返回的结果是true,反之返回的结果是false。

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

Hot Tools

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!