CentOS安装mysql遇到问题

前端之家收集整理的这篇文章主要介绍了CentOS安装mysql遇到问题前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

安装完毕MysqL服务在初始化数据库的时候报错

[root@MysqLMysqL]#/application/MysqL/bin/MysqL_install_db--basedir=/application/MysqL/--datadir=/application/MysqL/data/--user=MysqL
FATALERROR:Couldnotfinderrmsg.sys
Thefollowingdirectoriesweresearched:
/application/MysqL//share/english
/application/MysqL//share/MysqL/english
Ifyoucompiledfromsource,youneedtorun'makeinstall'to
copythesoftwareintothecorrectlocationreadyforoperation.
Ifyouareusingabinaryrelease,youmusteitherbeatthetop
leveloftheextractedarchive,orpassthe--basediroption
pointingtothatlocation.

打算重新编译重新 ./configure是正常的,但是一到make的时候就报错,如下

make报错

MysqL.cc:1040:error:redefinitionof‘struct_hist_entry’
../include/readline/readline.h:55:error:prevIoUsdefinitionof‘struct_hist_entry’
MysqL.cc:1043:error:invalidtypeindeclarationbefore‘;’token
MysqL.cc:1043:error:conflictingdeclaration‘typedefintHIST_ENTRY’
../include/readline/readline.h:58:error:‘HIST_ENTRY’hasaprevIoUsdeclarationas‘typedefstruct_hist_entryHIST_ENTRY’
MysqL.cc:Infunction‘voidinitialize_readline(char*)’:
MysqL.cc:2455:error:‘rl_completion_func_t’wasnotdeclaredinthisscope
MysqL.cc:2455:error:expectedprimary-expressionbefore‘)’token
MysqL.cc:2456:error:invalidconversionfrom‘char*(*)(constchar*,int)’to‘int(*)(constchar*,int)’
MysqL.cc:2458:error:invalidconversionfrom‘int(*)(int,int)’
MysqL.cc:2458:error:initializingargument2of‘intrl_add_defun(constchar*,int(*)(constchar*,int),int)’
make[2]:***[MysqL.o]Error1
make[2]:Leavingdirectory`/home/admin/tools/MysqL-5.1.62/client'
make[1]:***[all]Error2
make[1]:Leavingdirectory`/home/admin/tools/MysqL-5.1.62/client'
make:***[all-recursive]Error1

经过不懈奋斗,发现是由于第一次安装的时候,./configure make 之后忘记make install。又重新编译了

解决方法如下:

rm -fr ` find / -name MysqL` ###删除所有安装的内容

rm -fr /application/MysqL* ###删除安装路径的MysqL

后重启linux 重新编译安装


安装成功,初始化数据库后的输出显示

[root@MysqLMysqL]#/application/MysqL/bin/MysqL_install_db--basedir=/application/MysqL--datadir=/application/MysqL/data/--user=MysqL
InstallingMysqLsystemtables...
1702228:50:13[Warning]'--skip-locking'isdeprecatedandwillberemovedinafuturerelease.Pleaseuse'--skip-external-locking'instead.
OK
Fillinghelptables...
1702228:50:13[Warning]'--skip-locking'isdeprecatedandwillberemovedinafuturerelease.Pleaseuse'--skip-external-locking'instead.
OK
TostartMysqLdatboottimeyouhavetocopy
support-files/MysqL.servertotherightplaceforyoursystem
PLEASEREMEMBERTOSETAPASSWORDFORTHEMysqLrootUSER!
Todoso,starttheserver,thenissuethefollowingcommands:
/application/MysqL/bin/MysqLadmin-urootpassword'new-password'
/application/MysqL/bin/MysqLadmin-uroot-hMysqLpassword'new-password'
Alternativelyyoucanrun:
/application/MysqL/bin/MysqL_secure_installation
whichwillalsogiveyoutheoptionofremovingthetest
databasesandanonymoususercreatedbydefault.Thisis
stronglyrecommendedforproductionservers.
Seethemanualformoreinstructions.
YoucanstarttheMysqLdaemonwith:
cd/application/MysqL;/application/MysqL/bin/MysqLd_safe&
YoucantesttheMysqLdaemonwithMysqL-test-run.pl
cd/application/MysqL/MysqL-test;perlMysqL-test-run.pl
Pleasereportanyproblemswiththe/application/MysqL/scripts/MysqLbugscript!

配置MysqL默认配置和init.d启动

cpsupport-files/my-small.cnf/etc/my.cnf
cpsupport-files/MysqL.server/etc/init.d/
chmod+x/etc/init.d/MysqL.server
mv/etc/init.d/MysqL.server/etc/init.d/MysqLd
/etc/init.d/MysqLdstart

最后配置PATH

echo 'PATH=/application/MysqL/bin/:$PATH' >>/etc/profile

原文链接:https://www.f2er.com/centos/378652.html

猜你在找的CentOS相关文章