您的位置:首页 > 运维架构 > Linux

Linux 源码安装 MySQL 5.6

2014-12-17 11:36 549 查看
1.安装 mysql 依赖

# yum install –y make bison gcc gcc-c++cmake ncurses ncurses-devel

2. 开始安装 MySQL

下载MYSQL源码打包文件的地址:http://dev.mysql.com/downloads/mysql/

选择这个条目下载源码:Generic Linux (Architecture Independent), CompressedTAR Archive

(mysql-5.6.21.tar.gz)

安装之前先添加管理mysql的用户

# groupadd mysql

# useradd mysql -g mysql

#增加一个名为 mysql 的用户。

-g:指定新用户所属的用户组(group)

下载完毕后解压并安装 MySQL

# tar zxvf mysql-5.6.12.tar.gz

# cd mysql-5.6.12

# cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \

-DMYSQL_DATADIR=/usr/local/mysql/data \

-SYSCONFDIR=/etc \

-DWITH_MYISAM_STORAGE_ENGINE=1 \

-DWITH_INNOBASE_STORAGE_ENGINE=1 \

-DWITH_MEMORY_STORAGE_ENGINE=1 \

-DWITH_READLINE=1 \

-DMYSQL_UNIX_ADDR=/tmp/mysqld.sock \

-DMYSQL_TCP_PORT=3306 \

-DENABLED_LOCAL_INFILE=1 \

-DWITH_PARTITION_STORAGE_ENGINE=1 \

-DEXTRA_CHARSET=all \

-DDEFAULT_CHARSET=utf8 \

-DDEFAULT_COLLATION=utf8_general_ci

# make

# make install

# chown -R mysql:mysql /usr/local/mysql ( 把mysql安装目录下面的所有文件的user和group都改成mysql)

# chmod u+w /usr/local/mysql (让user对mysql安装目录有写的权限)

创建mysql数据库存放目录

# mkdir -p /data0/mysql/3306/data

改变user和group成为mysql

# chown mysql:mysql /data0/mysql/ -R

7.初始化mysql权限表,操作如下:

# cd /usr/local/mysql (进行mysql安装目录)

运行初始化mysql权限表的脚本:

# scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql--datadir=/data0/mysql/3306/data

8. 将 mysql的配置文件拷贝到/data0/mysql/3306/

# cp support-files/my-default.cnf /data0/mysql/3306/my.cnf

修改 mysql 配置文件my.cnf

如果在启动mysqld_safe服务器时候指定了/data0/mysql/3306/my.cnf配置文件,那么/etc/my.cnf就没有用了,不要保留了,删除就可以了。



# vi /etc/my.cnf

[client]
port=3306

socket
=
/tmp/mysqld.sock

default-character-set
=utf8

[mysqld]

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

port
=3306

basedir
=/usr/local/mysql

datadir
=/data0/mysql/3306/data

socket
=
/tmp/mysqld.sock
user
=mysql


default-time-zone
= system

character-set-server
=utf8

default-storage-engine
=InnoDB

log-error=/data0/mysql/3306/log/mysqld.log

pid-file=/var/run/mysqld/mysqld.pid

---------------------------------------------------------------------------------------------------------------------------------------

注意:如果指定了pid文件位置,必须确保运行mysqld进程的用户mysql具有对这个文件的写的权限,否则会出现下面的错误:

141016 15:30:43 mysqld_safe Logging to '/var/log/mysqld/mysqld.log'.

141016 15:30:43 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data

141016 15:30:43 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended

解决方法就是确保mysql能写这个文件:

mkdir /var/run/mysqld

chown mysql:mysql /var/run/mysqld

同时也要创建log目录

mkdir /data0/mysql/3306/log

chown mysql:mysql /data0/mysql/3306/log

---------------------------------------------------------------------------------------------

启动:(到/usr/local/mysql/bin目录下)

#./mysqld_safe --defaults-file=/data0/mysql/3306/my.cnf &

看是否成功

# ps -ef | grep mysqld
或者

# netstat -tunpl|grep mysqld


客户端连接服务器

# ./mysql -uroot -p -S /tmp/mysqld.sock

执行下列mysql语句加入以下两个用户:

mysql> grant all privileges on *.* to'admin'@'localhost'identified by '123456';

mysql> grant all privileges on *.* to'admin'@'127.0.0.1'identified by '123456';

mysql> quit;

测试admin用户是否能够登录系统:

# ./mysql -h 127.0.0.1 -u admin -p -S /tmp/mysqld.sock(回车输入密码123456)

注意:如果mysql服务器和客户端同在本机, -S/tmp/mysqld.sock可以指定,如果mysql服务器在远程时,不要指定。

9.修改root默认密码

刚安装后root默认密码为空,为了安全需要设置一个密码.

# cd /usr/local/mysql/bin

# ./mysqladmin -u root password(回车在接下来的提示中设置新密码即可,比如设置的root密码是654321)

关闭mysqld服务器

# ./bin/mysqladmin -u root -p -S /tmp/mysqld.sock shutdown(回车后输入刚才给root设置的654321密码关闭服务器)

mysql大功告成,下面的不用看,只是一些转载文章

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

转载:http://www.chenyudong.com/archives/building-mysql-5-6-from-source.html

源码编译安装MySQL5.6.16

mysql5.6.16的安装和之前的5.5、5.1有些不同,编译的时候不再使用
./configure
来进行了,使用了
cmake
命令来进行编译项目。

准备编译环境

因为我的Linux是刚安装的,需要安装很多的必要程序。

1
2
yum -y
install
make
gcc-c++ cmake bison-devel  ncurses-devel gcc\

autoconfautomake zlib* fiex* libxml* libmcrypt*libtool-ltdl-devel*


下载MySQL

进入http://dev.mysql.com/downloads/mysql/ 的source/GenericLinux (Architecture Independent), Compressed TAR Archive,文件mysql-5.6.16.tar.gz

1
2
3
wgethttp:
//dev
.mysql.com
/get/Downloads/MySQL-5
.6
/mysql-5
.6.16.
tar
.gz

tar
xvfmysql-5.6.16.
tar
.gz

cd
mysql-5.6.16


编译源码

接下来组织项目

01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
cmake \

-DCMAKE_INSTALL_PREFIX=
/usr/local/mysql
\

-DMYSQL_DATADIR=
/data/mysql/data
\

-DSYSCONFDIR=
/etc
\

-DWITH_MYISAM_STORAGE_ENGINE=1 \

-DWITH_INNOBASE_STORAGE_ENGINE=1 \

-DWITH_MEMORY_STORAGE_ENGINE=1 \

-DWITH_READLINE=1 \

-DMYSQL_UNIX_ADDR=
/tmp/mysql/mysql
.sock\

-DMYSQL_TCP_PORT=3306 \

-DENABLED_LOCAL_INFILE=1 \

-DWITH_PARTITION_STORAGE_ENGINE=1 \

-DEXTRA_CHARSETS=all \

-DDEFAULT_CHARSET=utf8 \

-DDEFAULT_COLLATION=utf8_general_ci


注意,这个cmake是替代以前的./configure 步骤。如果你需要更多的参数,请参考http://dev.mysql.com/doc/refman/5.6/en/source-configuration-options.html

有时候会出现类似的问题。

Googlemock was not found. gtest-based unit tests willbe disabled. You can run cmake . -DENABLE_DOWNLOADS=1 toautomatically download and build required components from source. —If you are inside a firewall, you may need to use an http proxy:export
http_proxy=http://example.com:80

使用参数-DENABLE_DOWNLOADS=1 自动下载。
有网络限制,设置http代理
exporthttp_proxy=http://example.com:80
。环境变量
http_proxy
也为 curl 等其他工具所用。尽管 yum 可以识别大写或小写的 http_proxy,但curl要求环境变量的名称是小写。

如果这个cmake这个步骤有出现问题,解决后重新再cmake一次。如果输出类似这样,那么就好了。

01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
-- Running cmake version 2.6.4

-- MySQL 5.6.16

-- Packaging as: mysql-5.6.16-Linux-x86_64

-- HAVE_VISIBILITY_HIDDEN

-- HAVE_VISIBILITY_HIDDEN

-- HAVE_VISIBILITY_HIDDEN

-- Using cmake version 2.6.4

-- Not building NDB

-- Library mysqlclient depends on OSLIBS-lpthread;m;rt;dl

--GMOCK_SOURCE_DIR:/root/mysql-5.6.16/source_downloads/gmock-1.6.0

-- GTEST_LIBRARIES:gmock;gtest

-- Library mysqlserver depends on OSLIBS-lpthread;m;rt;crypt;dl

-- Configuring done

-- Generating done

-- Build files have been written to:/root/mysql-5.6.16


接着编译源码

1
make
&&
make
install


编译时间缓慢,等待中…

修改文件权限,生成数据库

1
2
3
4
5
6
7
groupadd mysql

useradd
-r -g mysql mysql

cd
/usr/local/mysql

chown
-R mysql:mysql .

scripts
/mysql_install_db
--user=mysql--ldata=
/data/mysql/data

chown
-R root .

chown
-R mysql data


说明:参数
--ldata
说明你的数据文件存放的目录,如果你使用默认的路径,那么这个参数可以去除。如果你不增加此参数,但是在配置文件(见下方的datadir配置)中指定了其他的目录,那么会在启动MySQL的时候出现类似的提示:

Starting MySQL. ERROR! The server quit without updatingPID file (/data/mysql/data/VM_208.pid).
出现这个的解决办法就是增加
--ldata
参数,指定和配置文件中
datadir
相同的值,重新执行mysql_install_db即可。

设置配置文件

MySQL 5.6.8开始,就不在分发my.cnf等配置的demo,所以想随便拿一个用都比较麻烦。

my.cnf的配置文件的默认读取顺序为

File Name(上面的优先)Purpose
/etc/my.cnf
Global options
/etc/mysql/my.cnf
Global options
SYSCONFDIR
/my.cnf[/code]
Global options
$MYSQL_HOME/my.cnf
Server-specific options
defaults-extra-file
The file specified with
--defaults-extra-file=
path
,if any
~/.my.cnf
User-specific options
~/.mylogin.cnf
Login path options
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
[client]

port
=3306

socket
=/var/lib/mysql/mysql.sock

default-character-set
= utf8


[mysqld]

port
=3306

bind-address
=127.0.0.1

basedir
=/usr/local/mysql

datadir
=/data/data/mysql/data

socket
=/var/lib/mysql/mysql.sock

user
=mysql

# Disabling symbolic-links is recommended to preventassorted security risks

symbolic-links
=0


############# default settings ################

# time zone

default-time-zone
= system

character-set-server
= utf8

default-storage-engine
=InnoDB


[mysqld_safe]

log-error
=/var/log/mysqld.log

pid-file
=/var/run/mysqld/mysqld.pid


我的这个配置比较简单,声明一下常用的变量,如果你需要对性能优化,那么你需要细细研读一下配置文件。可以参考

http://www.ha97.com/4110.html
http://dev.mysql.com/doc/refman/5.6/en/server-options.html

启动MySQL,开机自动启动设置

手动启动MySQL。

1
2
3
4
cp
/usr/local/mysql/support-files/mysql
.server
/etc/init
.d
/mysql

/etc/init
.d
/mysql
start

##或者

service mysql start


在上面的步骤后,开机自动启动设置

1
2
3
chkconfig --add mysql

##有的系统需要下面的

chkconfig --level 345 mysql on


可以参考:http://dev.mysql.com/doc/refman/5.6/en/automatic-start.html

修改root密码

默认的密码是空的,很危险,需要修改一下。

在此之前,为方便调用mysql,我们先生成一个mysql的软链。

1
ln
-s
/usr/local/mysql/bin/mysql
/usr/bin/


然后修改密码

1
2
mysql -uroot  -h127.0.0.1-p

mysql> SET PASSWORD =PASSWORD(
'123456'
);


将来如果你忘记了root密码,可以参考重置MySQL密码

通过上面的步骤,就可以使用MySQL数据库了,另外可以为mysql安装phpmyadmin作为前端的管理界面。

转载http://www.linuxidc.com/Linux/2014-06/103893.htm

源码编译安装MySQL5.6.12详细过程

1 下载MySQL5.6.12社区版本安装包

------------------------------------------分割线------------------------------------------

FTP地址:ftp://ftp1.linuxidc.com

用户名:ftp1.linuxidc.com

密码:www.linuxidc.com

在 2014年LinuxIDC.com\6月\源码编译安装MySQL5.6.12详细过程

下载方法见 http://www.linuxidc.com/Linux/2013-10/91140.htm
------------------------------------------分割线-----------------------------------------

2安装cmake软件包

yuminstall cmake -y

3 create account of mysql

groupaddmysql

useradd -g mysql mysql

autoreconf --force --install

libtoolize --automake --force

automake --force --add-missing

4 complie the sources

数据目录: /home/data/mysql/data

mysql软件目录 : /usr/local/mysql

mkdir -p /home/data/mysql/data

mkdir -p /usr/local/mysql

tar -xvf mysql-5.6.12.tar.gz

cd mysql-5.6.12

5 预编译

[root@squid-2mysql-5.6.12]# time cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql-DMYSQL_DATADIR=/home/data/mysql/data-DWITH_INNOBASE_STORAGE_ENGINE=1-DMYSQL_UNIX_ADDR==/usr/local/mysql/mysql.sock
-DMYSQL_USER=mysql-DDEFAULT_CHARSET=utf8-DDEFAULT_COLLATION=utf8_general_ci

......

-- Check size of wint_t

-- Check size of wint_t - done

-- Could NOT find Curses (missing: CURSES_LIBRARYCURSES_INCLUDE_PATH)

CMake Error at cmake/readline.cmake:85 (MESSAGE):

Curses library not found. Please install appropriatepackage,

remove CMakeCache.txt and rerun cmake.On Debian/Ubuntu, package name
is libncurses5-dev, onRedHat and derivates it isncurses-devel.

Call Stack (most recent call first):

cmake/readline.cmake:128 (FIND_CURSES)

cmake/readline.cmake:202(MYSQL_USE_BUNDLED_EDITLINE)

CMakeLists.txt:325 (MYSQL_CHECK_EDITLINE)

-- Configuring incomplete, errors occurred!

real 0m41.872s

user 0m23.508s

sys 0m16.328s

6 yum install make

ok

[root@472322 mysql-5.6.13]#

[解决]

删除txt

[root@squid-2 mysql-5.6.12]# find / -nameCMakeCache.txt

/root/mysql/mysql-5.6.12/CMakeCache.txt

安装ncurses-devel

yum -y install ncurses-devel

再报错如下:

-- Performing Test HAVE_PEERCRED

CMake Error at/usr/share/cmake/Modules/CMakeCXXInformation.cmake:17(GET_FILENAME_COMPONENT):

get_filename_component called with incorrect number ofarguments

Call Stack (most recent call first):

CMakeLists.txt:3 (PROJECT)

CMake Error: CMAKE_CXX_COMPILER not set, afterEnableLanguage

CMake Error: Internal CMake error, TryCompile configure of cmakefailed

-- Performing Test HAVE_PEERCRED - Failed

-- Library mysqlclient depends on OSLIBS-lpthread;m;rt;dl

-- Googlemock was not found. gtest-based unit tests will bedisabled. You can run cmake . -DENABLE_DOWNLOADS=1 to automaticallydownload and build required components fromsource.

-- If you are inside a firewall, you may need to use an http proxy:export http_proxy=http://foo.bar.com:80

Warning: Bison executable not found in PATH

-- Library mysqlserver depends on OSLIBS-lpthread;m;rt;crypt;dl

-- Configuring incomplete, errors occurred!

real 0m42.841s

user 0m24.527s

sys 0m16.543s

-- Configuring incomplete, errors occurred!

real 0m0.510s

user 0m0.275s

sys 0m0.112s

[root@472322 mysql-5.6.13]#

yum install gcc gcc-c++ -y

yum install -y ncurses-devel.x86_64

yum install -y cmake.x86_64

yum install -y libaio.x86_64

yum install -y bison.x86_64

yum install -y gcc-c++.x86_64

[解决办法]:删除原来的mysql-5.6.12目录,重新解压缩tar.gz包

8 重新执行编译

rm-rf /root/mysql-5.6.12

cd /root/

tar -xvf mysql-5.6.12.tar.gz

cd /root/mysql-5.6.12

cmake. -DCMAKE_INSTALL_PREFIX=/usr/local/mysql-DMYSQL_DATADIR=/home/data/mysql/data-DWITH_INNOBASE_STORAGE_ENGINE=1-DMYSQL_UNIX_ADDR==/usr/local/mysql/mysql.sock
-DMYSQL_USER=mysql-DDEFAULT_CHARSET=utf8-DDEFAULT_COLLATION=utf8_general_ci


......

-- Looking for asprintf - found

-- Check size of pthread_t

-- Check size of pthread_t - done

-- Using cmake version 2.6.4

-- Not building NDB

-- Performing Test HAVE_PEERCRED

-- Performing Test HAVE_PEERCRED - Success

-- Library mysqlclient depends on OSLIBS-lpthread;m;rt;dl

-- Googlemock was not found. gtest-based unit tests will bedisabled. You can run cmake . -DENABLE_DOWNLOADS=1 to automaticallydownload and build required components fromsource.

-- If you are inside a firewall, you may need to use an http proxy:export http_proxy=http://foo.bar.com:80

-- Library mysqlserver depends on OSLIBS-lpthread;m;rt;crypt;dl

-- Configuring done

-- Generating done

-- Build files have been written to:/root/mysql/mysql-5.6.12

real 0m45.943s

user 0m26.213s

sys 0m17.661s

make

这一步时间比较长,需要耐心等待,看中间是否有error信息产生。

会看到很多Building信息

......

[ 38%] Building CXX objectstorage/innobase/CMakeFiles/innobase.dir/lock/lock0iter.cc.o

[ 38%] Building CXX objectstorage/innobase/CMakeFiles/innobase.dir/lock/lock0lock.cc.o

[ 38%] Building CXX objectstorage/innobase/CMakeFiles/innobase.dir/lock/lock0wait.cc.o

[ 38%] Building CXX objectstorage/innobase/CMakeFiles/innobase.dir/log/log0log.cc.o

[ 39%] Building CXX objectstorage/innobase/CMakeFiles/innobase.dir/log/log0recv.cc.o

[ 39%] Building CXX objectstorage/innobase/CMakeFiles/innobase.dir/mach/mach0data.cc.o

[ 39%] Building CXX objectstorage/innobase/CMakeFiles/innobase.dir/mem/mem0mem.cc.o

......

[100%] Building CXX objectmysql-test/lib/My/SafeProcess/CMakeFiles/my_safe_process.dir/safe_process.cc.o

Linking CXX executable my_safe_process

[100%] Built target my_safe_process

real 21m39.375s

user 18m9.239s

sys 1m34.320s

make install

......

-- Installing: /usr/local/mysql/man/man8/mysqld.8

-- Installing:/usr/local/mysql/support-files/solaris/postinstall-solaris

real 0m8.439s

user 0m3.353s

sys 0m4.616s

9 init db,初始化数据库

ll/home/data/mysql/data

cd /home/data/mysql/data

先赋予文件夹mysql权限

chown -R mysql /home/data/mysql/data

chgrp -R mysql /home/data/mysql/data

chown -R mysql /usr/local/mysql/

chgrp -R mysql /usr/local/mysql/

cd /usr/local/mysql/

cp support-files/my-default.cnf /etc/my56.cnf

scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql--datadir=/home/data/mysql/data--defaults-file=/usr/local/mysql/my.cnf

[root@localhost mysql]# scripts/mysql_install_db --user=mysql--basedir=/usr/local/mysql --datadir=/home/data/mysql/data--defaults-file=/usr/local/mysql/my.cnf

Installing MySQL system tables.../usr/local/mysql/bin/mysqld: File'/home/data/mysql/binlog/mysql-bin.index' not found (Errcode: 2 -No such file or directory)

2014-06-27 10:47:14 9686 [ERROR] Aborting

2014-06-27 10:47:14 9686 [Note] Binlog end

2014-06-27 10:47:14 9686 [Note] /usr/local/mysql/bin/mysqld:Shutdown complete

[root@localhost mysql]# mkdir -p/home/data/mysql/binlog/

[root@localhost mysql]#

[root@localhost mysql]# chown -R mysql/home/data/mysql/binlog/

[root@localhost mysql]# chgrp -R mysql/home/data/mysql/binlog/

建好目录,再执行数据库初始化:

[root@472322 mysql56]# scripts/mysql_install_db --user=mysql--basedir=/usr/local/mysql --datadir=/home/data/mysql/data--defaults-file=/usr/local/mysql/my.cnf

Installing MySQL system tables...2013-08-22 05:06:03 0 [Warning]TIMESTAMP with implicit DEFAULT value is deprecated. Please use--explicit_defaults_for_timestamp server option
(see documentationfor more details).

2013-08-22 05:06:03 19416 [Note] InnoDB: The InnoDB memory heap isdisabled

2013-08-22 05:06:03 19416 [Note] InnoDB: Mutexes and rw_locks useGCC atomic builtins

2013-08-22 05:06:03 19416 [Note] InnoDB: Compressed tables use zlib1.2.3

2013-08-22 05:06:03 19416 [Note] InnoDB: Using CPU crc32instructions

2013-08-22 05:06:03 19416 [Note] InnoDB: Initializing buffer pool,size = 128.0M

2013-08-22 05:06:03 19416 [Note] InnoDB: Completed initializationof buffer pool

2013-08-22 05:06:03 19416 [Note] InnoDB: The first specified datafile ./ibdata1 did not exist: a new database to becreated!

2013-08-22 05:06:03 19416 [Note] InnoDB: Setting file ./ibdata1size to 12 MB

2013-08-22 05:06:03 19416 [Note] InnoDB: Database physically writesthe file full: wait...

2013-08-22 05:06:03 19416 [Note] InnoDB: Setting log file./ib_logfile101 size to 48 MB

2013-08-22 05:06:03 19416 [Note] InnoDB: Setting log file./ib_logfile1 size to 48 MB

2013-08-22 05:06:03 19416 [Note] InnoDB: Renaming log file./ib_logfile101 to ./ib_logfile0

2013-08-22 05:06:03 19416 [Warning] InnoDB: New log files created,LSN=45781

2013-08-22 05:06:03 19416 [Note] InnoDB: Doublewrite buffer notfound: creating new

2013-08-22 05:06:03 19416 [Note] InnoDB: Doublewrite buffercreated

2013-08-22 05:06:03 19416 [Note] InnoDB: 128 rollback segment(s)are active.

2013-08-22 05:06:03 19416 [Warning] InnoDB: Creating foreign keyconstraint system tables.

2013-08-22 05:06:03 19416 [Note] InnoDB: Foreign key constraintsystem tables created

2013-08-22 05:06:03 19416 [Note] InnoDB: Creating tablespace anddatafile system tables.

2013-08-22 05:06:03 19416 [Note] InnoDB: Tablespace and datafilesystem tables created.

2013-08-22 05:06:03 19416 [Note] InnoDB: Waiting for purge tostart

2013-08-22 05:06:03 19416 [Note] InnoDB: 5.6.13 started; logsequence number 0

2013-08-22 05:06:04 19416 [Note] Binlog end

2013-08-22 05:06:04 19416 [Note] InnoDB: FTS optimize threadexiting.

2013-08-22 05:06:04 19416 [Note] InnoDB: Startingshutdown...

2013-08-22 05:06:05 19416 [Note] InnoDB: Shutdown completed; logsequence number 1625977

OK

Filling help tables...2013-08-22 05:06:05 0 [Warning] TIMESTAMPwith implicit DEFAULT value is deprecated. Please use--explicit_defaults_for_timestamp server option (see documentationfor
more details).

2013-08-22 05:06:05 19439 [Note] InnoDB: The InnoDB memory heap isdisabled

2013-08-22 05:06:05 19439 [Note] InnoDB: Mutexes and rw_locks useGCC atomic builtins

2013-08-22 05:06:05 19439 [Note] InnoDB: Compressed tables use zlib1.2.3

2013-08-22 05:06:05 19439 [Note] InnoDB: Using CPU crc32instructions

2013-08-22 05:06:05 19439 [Note] InnoDB: Initializing buffer pool,size = 128.0M

2013-08-22 05:06:05 19439 [Note] InnoDB: Completed initializationof buffer pool

2013-08-22 05:06:05 19439 [Note] InnoDB: Highest supported fileformat is Barracuda.

2013-08-22 05:06:05 19439 [Note] InnoDB: 128 rollback segment(s)are active.

2013-08-22 05:06:05 19439 [Note] InnoDB: Waiting for purge tostart

2013-08-22 05:06:05 19439 [Note] InnoDB: 5.6.13 started; logsequence number 1625977

2013-08-22 05:06:05 19439 [Note] Binlog end

2013-08-22 05:06:05 19439 [Note] InnoDB: FTS optimize threadexiting.

2013-08-22 05:06:05 19439 [Note] InnoDB: Startingshutdown...

2013-08-22 05:06:06 19439 [Note] InnoDB: Shutdown completed; logsequence number 1625987

OK

To start mysqld at boot time you have to copy

support-files/mysql.server to the right place for yoursystem

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER!

To do so, start the server, then issue the followingcommands:

/usr/local/mysql56/bin/mysqladmin -u root password'new-password'

/usr/local/mysql56/bin/mysqladmin -u root -h 472322.ea.com password'new-password'

Alternatively you can run:

/usr/local/mysql56/bin/mysql_secure_installation

which will also give you the option of removing thetest

databases and anonymous user created by default. Thisis

strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:

cd . ; /usr/local/mysql56/bin/mysqld_safe &

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

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

Please report any problems with the ./bin/mysqlbugscript!

The latest information about MySQL is available on the webat
http://www.mysql.com
Support MySQL by buying support/licenses athttp://shop.mysql.com

New default config file was created as /usr/local/mysql56/my.cnfand

will be used by default by the server when you startit.

You may edit this file to change server settings

WARNING: Default config file /etc/my.cnf exists on thesystem

This file will be read by default by the MySQLserver

If you do not want to use this, either remove it, or usethe

--defaults-file argument to mysqld_safe when starting theserver

[root@472322 mysql56]#

10 copy start command

cp support-files/mysql.server/etc/init.d/mysqld5612

chmod 700 /etc/init.d/mysqld5612

echo "exportPATH=$PATH:/usr/local/mysql/bin">>/etc/profile

source /etc/profile

11 添加开机启动

chkconfig--add mysqld5612

12 start service

service mysqld5612 start

[root@squid-2 mysql]# service mysqld5612 start

Starting MySQL.......The server quit without updating PIDf[失败]usr/local/mysql/mysqld.pid).

[root@squid-2 mysql]#

查看日志报错如下:

2014-06-24 14:56:54 31726 [Note] Server socket created on IP:'::'.

2014-06-24 14:56:54 31726 [ERROR] Can't start server : Bind on unixsocket: Permission denied

2014-06-24 14:56:54 31726 [ERROR] Do you already have anothermysqld server running on socket: /usr/local/mysql/mysql.sock?

2014-06-24 14:56:54 31726 [ERROR] Aborting

解决原因是:

/usr/local/mysql跟目录需要赋予mysql权限

根据日志文件显示,首先检查运行权限,再看一下/usr/local/mysql/mysql.sock,发现/usr/local/mysql目录下并没有该文件,是否是没有权限写目录?

看到/usr/local/mysql目录是root用户,所以赋予mysql操作权限。

chown -R mysql.mysql /usr/local/mysql

[root@472322 data56]# service mysqld5612 start

Starting MySQL. SUCCESS!

[root@472322 data56]# mysql

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

Your MySQL connection id is 1

Server version: 5.6.13 Source distribution

Copyright (c) 2000, 2013,Oracle and/or its affiliates. All rightsreserved.

Oracle is a registered trademark of Oracle Corporation and/orits

affiliates. Other names may be trademarks of theirrespective

owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current inputstatement.

mysql> show databases;

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

| Database |

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

| information_schema |

| mysql |

| performance_schema |

| test |

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

4 rows in set (0.00 sec)

mysql>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: