没有root权限的Mysql

时间:2016-07-06 22:14:07

标签: mysql database

如何在没有root权限/写入工具区访问权限的情况下启动mysql? 我收到了以下错误

host13:~/JS> mysqld start
160706 18:06:31 [Warning] Can't create test file /tool/p64/.package/mysql-5.5.21/data/host13.lower-test
160706 18:06:31 [Warning] Can't create test file /tool/p64/.package/mysql-5.5.21/data/host13.lower-test
mysqld: Table 'mysql.plugin' doesn't exist
160706 18:06:31 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
160706 18:06:31 InnoDB: The InnoDB memory heap is disabled
160706 18:06:31 InnoDB: Mutexes and rw_locks use GCC atomic builtins
160706 18:06:31 InnoDB: Compressed tables use zlib 1.2.3
160706 18:06:31 InnoDB: Initializing buffer pool, size = 128.0M
160706 18:06:31 InnoDB: Completed initialization of buffer pool
160706 18:06:31  InnoDB: Operating system error number 30 in a file operation.
InnoDB: Error number 30 means 'Read-only file system'.
InnoDB: Some operating system error numbers are described at
InnoDB: http://dev.mysql.com/doc/refman/5.5/en/operating-system-error-codes.html
InnoDB: File name ./ibdata1
InnoDB: File operation call: 'create'.
InnoDB: Cannot continue operation.

2 个答案:

答案 0 :(得分:1)

您可以将MySQL数据目录移动到您能够写入的位置,然后在/etc/my.cnf(或可能是其他位置,具体取决于您的系统默认值)中指定它,参数为datadir

如果您的数据目录尚未初始化(在这种情况下mysqld会抱怨缺少权限表),您可以像这样创建它们:

mysql_install_db --datadir=$path_to_new_datadir

答案 1 :(得分:0)

总结答案:

# Setup DB
mysql_install_db --datadir=<FULL PATH TO STORE DB FILES> 

# Start server
mysqld --datadir=<FULL PATH TO STORE DB FILES> 

# Shutdown server
mysqladmin -u root shutdown

注意:
 1. =之后的datadir - 没有命令将失败
 2.应使用完整路径