已经从这里的堆栈溢出,重新发布的问题,并添加my.cnf在文章的末尾。
到目前为止,在我使用linux的10+年经验中,我遇到的所有权限问题都已经用chmod -R 777 /path/where/the/problem/has/occured成功地解决了(每个谎言都有一点道理:)
这一次诀窍行不通,所以我求助于你。我正在用zc.buildout (www )从头开始编译mysql服务器。建立起来。( org)我通过执行/home/toinbis/.../parts/mysql/bin/mysqld_safe启动它,这是可行的。问题是,我将从内部主管(监督)启动这个项目。( org)脚本,在部署服务器上使用时,需要使用根权限启动它(这样,用相同脚本启动的nginx服务器就可以访问80个端口)。问题是sudo /home/toinbis/.../parts/mysql/bin/mysqld_safe失败了,在mysql错误日志中生成错误(apache按预期工作)。
http://lists.mysql.com/mysql/216045建议,“有两个错误:缺少表和mysqld无法访问的文件系统”。Mysqldatadir和所有mysql服务器二进制文件都有777个权限,talbe mysql.plugin确实存在,并且有777个权限(为什么是Can't open the mysql.plugin table?),"sudo mysql_datadir/tmp/ file“创建文件(为什么是Can't create/write to file /home/toinbis/.../runtime/mysql_datadir/tmp/ib4e9Huz?)。
chgrp -R mysql mysql_datadir和在mysql组中添加"root、toinbis、mysql“用户( cat /etc/group | grep mysql outputs mysql:x:124:root,toinbis,mysql)没有任何影响--当我以普通用户的身份启动它时,当它作为根用户启动时,它就失败了。mysql服务器,甚至以root用户的身份启动,是否试图以其他用户的身份进行操作,比如说,“mysql”用户?但是即使在这种情况下,将mysql用户添加到mysql组并使所有mysql_datadirs文件都属于mysql组,也会使事情顺利进行。
我确实知道,将nginx作为root和mysql发布可能是一个更好的主意--只是作为一个用户,但是这个错误让我非常恼火,所以我需要投入足够的精力,不仅要“让事情正常工作”,而且要让事情按照我最初的想法工作,这样就可以证明它是可能的。
这是生成的错误:
091213 20:02:55 mysqld_safe Starting mysqld daemon with databases from /home/toinbis/.../runtime/mysql_datadir
/home/toinbis/.../parts/mysql/libexec/mysqld: Table 'plugin' is read only
091213 20:02:55 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
/home/toinbis/.../parts/mysql/libexec/mysqld: Can't create/write to file '/home/toinbis/.../runtime/mysql_datadir/tmp/ib4e9Huz' (Errcode: 13)
091213 20:02:55 InnoDB: Error: unable to create temporary file; errno: 13
091213 20:02:55 [ERROR] Plugin 'InnoDB' init function returned error.
091213 20:02:55 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
091213 20:02:55 [ERROR] Can't start server : Bind on unix socket: Permission denied
091213 20:02:55 [ERROR] Do you already have another mysqld server running on socket: /home/toinbis/.../runtime/var/pids/mysql.sock ?
091213 20:02:55 [ERROR] Aborting
091213 20:02:55 [Note] /home/toinbis/.../parts/mysql/libexec/mysqld: Shutdown complete
091213 20:02:55 mysqld_safe mysqld from pid file /home/toinbis/.../runtime/var/pids/mysql.pid ended我的my.cnf ( basedir和datadir(包括tempdir)有chmod -R 777 permissions):
[client]
socket = /home/toinbis/.../runtime/var/pids/mysql.sock
port = 8002
[mysqld_safe]
socket = /home/toinbis/.../runtime/var/pids/mysql.sock
nice = 0
[mysqld]
#
# * Basic Settings
#
socket = /home/toinbis/.../runtime/var/pids/mysql.sock
port = 8002
pid-file = /home/toinbis/.../runtime/var/pids/mysql.pid
basedir = /home/toinbis/.../parts/mysql
datadir = /home/toinbis/.../runtime/mysql_datadir
tmpdir = /home/toinbis/.../runtime/mysql_datadir/tmp
skip-external-locking
bind-address = 127.0.0.1
log-error =/home/toinbis/.../runtime/logs/mysql_errorlog
#
# * Fine Tuning
#
key_buffer = 16M
max_allowed_packet = 32M
thread_stack = 128K
thread_cache_size = 8
myisam-recover = BACKUP
#max_connections = 100
#table_cache = 64
#thread_concurrency = 10
#
# * Query Cache Configuration
#
query_cache_limit = 1M
query_cache_size = 16M
#
# * Logging and Replication
#
# Both location gets rotated by the cronjob.
# Be aware that this log type is a performance killer.
#log = /home/toinbis/.../runtime/logs/mysql_logs/mysql.log
#
# Error logging goes to syslog. This is a Debian improvement :)
#
# Here you can see queries with especially long duration
#log_slow_queries = /home/toinbis/.../runtime/logs/mysql_logs/mysql-slow.log
#long_query_time = 2
#log-queries-not-using-indexes
#
# The following can be used as easy to replay backup logs or for replication.
#server-id = 1
#log_bin = /home/toinbis/.../runtime/mysql_datadir/mysql-bin.log
#binlog_format = ROW
#read_only = 0
#expire_logs_days = 10
#max_binlog_size = 100M
#sync_binlog = 1
#binlog_do_db = include_database_name
#binlog_ignore_db = include_database_name
#
# * InnoDB
#
innodb_data_file_path = ibdata1:10M:autoextend
innodb_buffer_pool_size=64M
innodb_log_file_size=16M
innodb_log_buffer_size=8M
innodb_flush_log_at_trx_commit=1
innodb_file_per_table
innodb_locks_unsafe_for_binlog=1
[mysqldump]
quick
quote-names
max_allowed_packet = 32M
[mysql]
#no-auto-rehash # faster start of mysql but no tab completion
[isamchk]
key_buffer = 16M任何想法都非常感谢!
打招呼,
至
对不起,这是我的第一篇文章,SF的反垃圾邮件功能不允许正确地发布它们:)
发布于 2009-12-16 13:05:28
第一次?不要用777来做这个。不要。守护进程不作为根用户运行是有原因的(如果其中任何一个都有缓冲区溢出,那么就会出现严重的安全问题--如果有人通过SQL注入或其他方式成功进入您的网站,它们只会根植您的框)。打开端口后,使用包装脚本删除特权。Nginx也不需要作为root运行。
其次,你的问题似乎是路径。不是许可。除非您已经在本文中使用/.../代替了实际路径,否则这就是您的问题所在。如果您这样做了,请用完整的路径更新问题。
发布于 2009-12-15 19:22:08
您的主目录是否安装在NFS上,安装在配置中,这会将根权限压缩到“任何人”吗?如果是这样,从另一个用户开始,或者不将数据存储在NFS中,或者在不使用root_squash的情况下导出NFS共享。
发布于 2009-12-15 19:26:58
我正在用zc.buildout (www )从头开始编译mysql服务器。建立起来。( org)
看上去你搞得一团糟!)
您为什么要从源编译MySQL服务器有特定的原因吗?我找到了这个MySQL“构建”脚本“,这可能与您正在做的事情有关:它似乎下载MySQL服务器和一个包来支持MySQL,然后在非标准位置编译和安装这些服务器。
无论如何,MySQL特别建议不要从源代码编译,因为它们为各种不同的平台提供了自己的优化二进制包。
如果您正在部署到一个很好的包管理系统,那么您的“构建”脚本只需要调用目标系统的包管理器。这将给您一个供应商推荐和批准的安装(不需要chmod -R 777!)在几个命令里。对于RHEL/CentOS系统,程序大致是:
yum install mysql-server (MySQL-python?)
[edit /etc/my.cnf]
chkconfig mysqld on && service mysqld start
[lock down the server by adjusting the grants]看看它是多么简单,可重复:)。与非标准的安装位置和chmod -R 777游戏相比,除非你有一个很好的理由,使用你的系统内置的软件包管理绝对是更好的选择。
https://serverfault.com/questions/94646
复制相似问题