Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2768532
  • 博文数量: 389
  • 博客积分: 4177
  • 博客等级: 上校
  • 技术积分: 4773
  • 用 户 组: 普通用户
  • 注册时间: 2008-11-16 23:29
文章分类

全部博文(389)

分类: Mysql/postgreSQL

2014-07-05 01:18:32

                                    MySQL二进制安装常见问题处理


     MySQL的一般安装方式主要有三种:1,源码安装;2,RPM包安装;3,二进制安装. 前两种安装方式
个人都不太推荐,源码方式一般高级用户使用,而且稳定性不一定有保证,好处是可以自定义很多选项.
比如激活debug功能等.rpm包的方式安装位置比较混乱。

   二进制安装是从直接从官网或是第三方编译好的二进制文件直接复制到os上,再进行一些简单就可以使用.
好处是第三方编译比较稳定,安装位置自定义程度比较高.

   常见安装问题:
 
 1,没有mysql用户和组.

   mysql服务器进程是一般是以非root用户运行,为了安全起见尽量不使用root用户来运行.
 

[root@db135 bin]# ./mysqld_safe  --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
140704 16:10:10 mysqld_safe Logging to '/usr/local/mysql/data/db135.err'.
chown: “mysql”: 无效的用户

启动mysql服务器进程,没有指定用户,服务器进程会以mysql用户来运行,如果没有该用户则报错.


 2,权限错误.在安装之前需要更改安装目标所有者和组为mysql,否则在初始化脚本执行进报错.

 
[root@db135 mysql]# ./scripts/mysql_install_db  --user=mysql
Installing MySQL system tables...
140704 16:13:37 [ERROR] ./bin/mysqld: Can't find file: './mysql/db.frm' (errno: 13)
ERROR: 1017  Can't find file: './mysql/db.frm' (errno: 13)
140704 16:13:37 [ERROR] Aborting

140704 16:13:37 [Note] ./bin/mysqld: Shutdown complete


Installation of system tables failed!  Examine the logs in
./data for more information.


 3,初始化脚本只能在安装目录执行(假设为/usr/local/mysql)

试图输入绝对路径.

[root@db135 local]# /usr/local/mysql/scripts/mysql_install_db  --user=mysql

FATAL ERROR: Could not find ./bin/my_print_defaults

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.

正确的执行方式

[root@db135 mysql]# pwd
/usr/local/mysql

[root@db135 mysql]# ./scripts/mysql_install_db --user=mysql
Installing MySQL system tables...
OK
Filling help tables...
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system
...........................

4,DATA目录没有相应权限,确保mysql服务器进程运行用户对data目录有读写权限.

打开日志文件时失败.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
InnoDB: File name ./ibdata1
InnoDB: File operation call: 'open'.
InnoDB: Cannot continue operation.

5,mysql系统启动脚本或是mysqld_safe脚本不能正常运行,在linux平台上大部分是通过
mysqld_safe或是位于$MYSQL/support-files/mysql.server(复制到/etc/init.d)来启动的.
需要修改其中的位置决定mysql的真正位置.

mysql.server文件中的

basedir=
datadir=


6,部分mysql版本和linux库兼容性问题,比如一些较旧的库链接文件

ln -s /usr/lib/libcrypto.so.1.0.0 /usr/lib/libcrypto.so.6
ln -s /usr/lib/libssl.so.1.0.0 /usr/lib/libssl.so.6

具体视版本不同,可能不一样.


7,确认mysql的端口没有被占用,selinux关闭和iptables进行相应的配置

140704 16:34:40 [ERROR] Do you already have another mysqld server running on port: 3306 ?
140704 16:34:40 [ERROR] Aborting

140704 16:34:40  InnoDB: Starting shutdown...

阅读(3194) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~