首页 > 代码库 > CentOS安装mysql遇到问题
CentOS安装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
本文出自 “董利强” 博客,请务必保留此出处http://6207422.blog.51cto.com/6197422/1900093
CentOS安装mysql遇到问题
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。