CentOS6.5编译安装mysql5.7.11

前端之家收集整理的这篇文章主要介绍了CentOS6.5编译安装mysql5.7.11前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

1、安装相关依赖包

yum-yinstallgcc*autoconfautomakezlib*fiex*libxml*ncurses-devellibmcrypt*libmcrypt*libtool-ltdl-devel*

2、需要安装个包

  • 安装cmake

root@localhostsrc]#tarzxvfcmake-2.8.5.tar.gz

[root@localhostsrc]#cdcmake-2.8.5

[root@localhostcmake-2.8.5]#./bootstrap

…………

--Buildfileshavebeenwrittento:/usr/local/src/cmake-2.8.5

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

CMakehasbootstrapped.Nowrungmake.

gmake

[100%]BuildingCXXobjectTests/CMakeLib/CMakeFiles/runcompilecommands.dir/run_compile_commands.cxx.o

LinkingCXXexecutableruncompilecommands

[100%]Builttargetruncompilecommands

gmakeinstall

cd..

groupaddMysqL

useradd-gMysqLMysqL

tarzxvfMysqL-5.7.11.tar.gz

cdMysqL-5.7.11

[root@localhostMysqL-5.7.11]#

cmake-DCMAKE_INSTALL_PREFIX=/usr/local/MysqL\

-DMysqL_UNIX_ADDR=/tmp/MysqL.sock\

-DDEFAULT_CHARSET=utf8\

-DDEFAULT_COLLATION=utf8_general_ci\

-DEXTRA_CHARSETS=all\

-DWITH_EXTRA_CHARSETS:STRING=utf8,gbk\

-DWITH_MYISAM_STORAGE_ENGINE=1\

-DWITH_INNOBASE_STORAGE_ENGINE=1\

-DWITH_MEMORY_STORAGE_ENGINE=1\

-DWITH_READLINE=1\

-DENABLED_LOCAL_INFILE=1\

-DMysqL_DATADIR=/var/MysqL/data\

-DMysqL_USER=MysqL\

-DDOWNLOAD_BOOST=1\

-DWITH_BOOST=/usr/local/boost/boost_1_59_0

CMakeWarning:

Manually-specifiedvariableswerenotusedbytheproject:

MysqL_USER

WITH_MEMORY_STORAGE_ENGINE

--Buildfileshavebeenwrittento:/usr/local/src/MysqL-5.7.11

[root@localhostMysqL-5.7.11]#make

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

LinkingCXXexecutablemy_safe_process

[100%]Builttargetmy_safe_process

makeinstall

--Installing:/usr/local/MysqL/man/man1/MysqL_find_rows.1

--Installing:/usr/local/MysqL/man/man1/MysqL_upgrade.1

--Installing:/usr/local/MysqL/man/man1/MysqLimport.1

--Installing:/usr/local/MysqL/man/man1/MysqL_client_test.1

--Installing:/usr/local/MysqL/man/man8/MysqLd.8

chmod+w/usr/local/MysqL/

chown-RMysqL:MysqL/usr/local/MysqL/

ln-s/usr/local/MysqL/lib/libMysqLclient.so.18/usr/lib/libMysqLclient.so.18

mkdir-p/var/MysqL

mkdir-p/var/MysqL/log/

chown-RMysqL:MysqL/var/MysqL/

cdsupport-files/

[root@localhostsupport-files]#cpmy-medium.cnf/etc/my.cnf

cpMysqL.server/etc/init.d/MysqL

[root@localhostsupport-files]#vim /etc/my.cnf

[MysqLd]
#Removeleading#andsettotheamountofRAMforthemostimportantdata
#cacheinMysqL.Startat70%oftotalRAMfordedicatedserver,else10%.
#innodb_buffer_pool_size=128M
#Removeleading#toturnonaveryimportantdataintegrityoption:logging
#changestothebinarylogbetweenbackups.
#log_bin=MysqL-bin
#Thesearecommonlyset,removethe#andsetasrequired.
basedir=/usr/local/MysqL
datadir=/var/MysqL/data
port=3306
#server_id=.....
socket=/tmp/MysqL.sock
#defaults-file=/etc/my.cnf
explicit_defaults_for_timestamp=true

初始化MysqL

/usr/local/MysqL/bin/MysqLd--initialize-insecure--user=MysqL--basedir=/usr/local/MysqL--datadir=/var/MysqL/data

YoucanstarttheMysqLdaemonwith:

cd/usr/local/MysqL;/usr/local/MysqL/bin/MysqLd_safe&

YoucantesttheMysqLdaemonwithMysqL-test-run.pl

cd/usr/local/MysqL/MysqL-test;perlMysqL-test-run.pl

Pleasereportanyproblemswiththe/usr/local/MysqL/scripts/MysqLbugscript!


chmod+x/etc/init.d/MysqL

vi/etc/init.d/MysqL

basedir=/usr/local/MysqL

datadir=/var/MysqL/data

chkconfig--addMysqL

chkconfig--level345MysqLon

cd/usr/local/MysqL

[root@localhostMysqL]#serviceMysqLstart

StartingMysqL..SUCCESS!

MysqL

-bash:MysqL:commandnotfound

/usr/local/MysqL/bin/MysqL-urootMysqL

MysqL>showdatabases;

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

|Database|

|information_schema|

|MysqL|

|performance_schema|

|test|

4rowsinset(0.01sec)

MysqL>exit

Bye

ln-s/usr/local/MysqL/bin/MysqL/usr/bin

ln-s/usr/local/MysqL/bin/MysqLadmin/usr/bin

MysqL

showdatabases;

4rowsinset(0.00sec)

grantallprivilegeson*.*toroot@'%'identifiedby'123456'withgrantoption;

QueryOK,0rowsaffected(0.00sec)

flushprivileges;

/etc/init.d/iptablesstop;

Flushingfirewallrules:[OK]

SettingchainstopolicyACCEPT:filter[OK]

Unloadingiptablesmodules:[OK]

开启端口3306的访问:

sbin/iptables-IINPUT-ptcp--dport3306-jACCEPT

serviceiptablessave

原文链接:/centos/380911.html

猜你在找的CentOS相关文章