MySQL数据库之CentOS安装mysql遇到问题
小标 2018-09-12 来源 : 阅读 1162 评论 0

摘要:本文主要向大家介绍了MySQL数据库之CentOS安装mysql遇到问题 ,通过具体的内容向大家展现,希望对大家学习MySQL数据库有所帮助。

本文主要向大家介绍了MySQL数据库之CentOS安装mysql遇到问题 ,通过具体的内容向大家展现,希望对大家学习MySQL数据库有所帮助。

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

[root@mysql mysql]# /application/mysql/bin/mysql_install_db --basedir=/application/mysql/ --datadir=/application/mysql/data/ --user=mysql
FATAL ERROR: Could not find errmsg.sys
The following directories were searched:
    /application/mysql//share/english
    /application/mysql//share/mysql/english
If you compiled from source, you need to run ‘make install‘ to
copy the software into the correct location ready for operation.
If you are using a binary release, you must either be at the top
level of the extracted archive, or pass the --basedir option
pointing to that location.
打算重新编译重新 ./configure是正常的,但是一到make的时候就报错,如下

make报错

mysql.cc:1040: error: redefinition of ‘struct _hist_entry’
../include/readline/readline.h:55: error: previous definition of ‘struct _hist_entry’
mysql.cc:1043: error: invalid type in declaration before ‘;’ token
mysql.cc:1043: error: conflicting declaration ‘typedef int HIST_ENTRY’
../include/readline/readline.h:58: error: ‘HIST_ENTRY’ has a previous declaration as ‘typedef struct _hist_entry HIST_ENTRY’
mysql.cc: In function ‘void initialize_readline(char*)’:
mysql.cc:2455: error: ‘rl_completion_func_t’ was not declared in this scope
mysql.cc:2455: error: expected primary-expression before ‘)’ token
mysql.cc:2456: error: invalid conversion from ‘char* (*)(const char*, int)’ to ‘int (*)(const char*, int)’
mysql.cc:2458: error: invalid conversion from ‘int (*)(int, int)’ to ‘int (*)(const char*, int)’
mysql.cc:2458: error:   initializing argument 2 of ‘int rl_add_defun(const char*, int (*)(const char*, int), int)’
make[2]: *** [mysql.o] Error 1
make[2]: Leaving directory `/home/admin/tools/mysql-5.1.62/client‘
make[1]: *** [all] Error 2
make[1]: Leaving directory `/home/admin/tools/mysql-5.1.62/client‘
make: *** [all-recursive] Error 1
经过不懈奋斗,发现是由于第一次安装的时候,./configure make 之后忘记make install。又重新编译了 

解决方法如下:

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

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

后重启linux 重新编译安装



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

[root@mysql mysql]#  /application/mysql/bin/mysql_install_db --basedir=/application/mysql --datadir=/application/mysql/data/ --user=mysql
Installing MySQL system tables...
170222  8:50:13 [Warning] ‘--skip-locking‘ is deprecated and will be removed in a future release. Please use ‘--skip-external-locking‘ instead.
OK
Filling help tables...
170222  8:50:13 [Warning] ‘--skip-locking‘ is deprecated and will be removed in a future release. Please use ‘--skip-external-locking‘ instead.
OK
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/application/mysql/bin/mysqladmin -u root password ‘new-password‘
/application/mysql/bin/mysqladmin -u root -h mysql password ‘new-password‘
Alternatively you can run:
/application/mysql/bin/mysql_secure_installation
which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.
See the manual for more instructions.
You can start the MySQL daemon with:
cd /application/mysql ; /application/mysql/bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
cd /application/mysql/mysql-test ; perl mysql-test-run.pl
Please report any problems with the /application/mysql/scripts/mysqlbug script!
配置mysql默认配置和init.d启动

cp support-files/my-small.cnf /etc/my.cnf 
cp support-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/mysqld start
最后配置PATH

echo ‘PATH=/application/mysql/bin/:$PATH‘ >>/etc/profile    

本文由职坐标整理并发布,希望对同学们学习MySQL有所帮助,更多内容请关注职坐标数据库MySQL数据库频道!

本文由 @小标 发布于职坐标。未经许可,禁止转载。
喜欢 | 0 不喜欢 | 0
看完这篇文章有何感觉?已经有0人表态,0%的人喜欢 快给朋友分享吧~
评论(0)
后参与评论

您输入的评论内容中包含违禁敏感词

我知道了

助您圆梦职场 匹配合适岗位
验证码手机号,获得海同独家IT培训资料
选择就业方向:
人工智能物联网
大数据开发/分析
人工智能Python
Java全栈开发
WEB前端+H5

请输入正确的手机号码

请输入正确的验证码

获取验证码

您今天的短信下发次数太多了,明天再试试吧!

提交

我们会在第一时间安排职业规划师联系您!

您也可以联系我们的职业规划师咨询:

小职老师的微信号:z_zhizuobiao
小职老师的微信号:z_zhizuobiao

版权所有 职坐标-一站式IT培训就业服务领导者 沪ICP备13042190号-4
上海海同信息科技有限公司 Copyright ©2015 www.zhizuobiao.com,All Rights Reserved.
 沪公网安备 31011502005948号    

©2015 www.zhizuobiao.com All Rights Reserved

208小时内训课程