CentOS安装mysql遇到问题

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

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

  1. [root@MysqLMysqL]#/application/MysqL/bin/MysqL_install_db--basedir=/application/MysqL/--datadir=/application/MysqL/data/--user=MysqL
  2. FATALERROR:Couldnotfinderrmsg.sys
  3. Thefollowingdirectoriesweresearched:
  4. /application/MysqL//share/english
  5. /application/MysqL//share/MysqL/english
  6. Ifyoucompiledfromsource,youneedtorun'makeinstall'to
  7. copythesoftwareintothecorrectlocationreadyforoperation.
  8. Ifyouareusingabinaryrelease,youmusteitherbeatthetop
  9. leveloftheextractedarchive,orpassthe--basediroption
  10. pointingtothatlocation.

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

make报错

  1. MysqL.cc:1040:error:redefinitionofstruct_hist_entry
  2. ../include/readline/readline.h:55:error:prevIoUsdefinitionofstruct_hist_entry
  3. MysqL.cc:1043:error:invalidtypeindeclarationbefore‘;’token
  4. MysqL.cc:1043:error:conflictingdeclarationtypedefintHIST_ENTRY
  5. ../include/readline/readline.h:58:error:‘HIST_ENTRYhasaprevIoUsdeclarationastypedefstruct_hist_entryHIST_ENTRY
  6. MysqL.cc:Infunctionvoidinitialize_readline(char*)’:
  7. MysqL.cc:2455:error:‘rl_completion_func_twasnotdeclaredinthisscope
  8. MysqL.cc:2455:error:expectedprimary-expressionbefore‘)’token
  9. MysqL.cc:2456:error:invalidconversionfromchar*(*)(constchar*,int)’toint(*)(constchar*,int)’
  10. MysqL.cc:2458:error:invalidconversionfromint(*)(int,int)’
  11. MysqL.cc:2458:error:initializingargument2ofintrl_add_defun(constchar*,int(*)(constchar*,int),int)’
  12. make[2]:***[MysqL.o]Error1
  13. make[2]:Leavingdirectory`/home/admin/tools/MysqL-5.1.62/client'
  14. make[1]:***[all]Error2
  15. make[1]:Leavingdirectory`/home/admin/tools/MysqL-5.1.62/client'
  16. make:***[all-recursive]Error1

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

解决方法如下:

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

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

后重启linux 重新编译安装


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

  1. [root@MysqLMysqL]#/application/MysqL/bin/MysqL_install_db--basedir=/application/MysqL--datadir=/application/MysqL/data/--user=MysqL
  2. InstallingMysqLsystemtables...
  3. 1702228:50:13[Warning]'--skip-locking'isdeprecatedandwillberemovedinafuturerelease.Pleaseuse'--skip-external-locking'instead.
  4. OK
  5. Fillinghelptables...
  6. 1702228:50:13[Warning]'--skip-locking'isdeprecatedandwillberemovedinafuturerelease.Pleaseuse'--skip-external-locking'instead.
  7. OK
  8. TostartMysqLdatboottimeyouhavetocopy
  9. support-files/MysqL.servertotherightplaceforyoursystem
  10. PLEASEREMEMBERTOSETAPASSWORDFORTHEMysqLrootUSER!
  11. Todoso,starttheserver,thenissuethefollowingcommands:
  12. /application/MysqL/bin/MysqLadmin-urootpassword'new-password'
  13. /application/MysqL/bin/MysqLadmin-uroot-hMysqLpassword'new-password'
  14. Alternativelyyoucanrun:
  15. /application/MysqL/bin/MysqL_secure_installation
  16. whichwillalsogiveyoutheoptionofremovingthetest
  17. databasesandanonymoususercreatedbydefault.Thisis
  18. stronglyrecommendedforproductionservers.
  19. Seethemanualformoreinstructions.
  20. YoucanstarttheMysqLdaemonwith:
  21. cd/application/MysqL;/application/MysqL/bin/MysqLd_safe&
  22. YoucantesttheMysqLdaemonwithMysqL-test-run.pl
  23. cd/application/MysqL/MysqL-test;perlMysqL-test-run.pl
  24. Pleasereportanyproblemswiththe/application/MysqL/scripts/MysqLbugscript!

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

  1. cpsupport-files/my-small.cnf/etc/my.cnf
  2. cpsupport-files/MysqL.server/etc/init.d/
  3. chmod+x/etc/init.d/MysqL.server
  4. mv/etc/init.d/MysqL.server/etc/init.d/MysqLd
  5. /etc/init.d/MysqLdstart

最后配置PATH

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

猜你在找的CentOS相关文章