简体   繁体   中英

Mysql without root privilege

How do I start mysql without having root privileges/write access to tool area ? I am getting following error

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.

You can move MySQL data directory to where you are able to write, and then specify it in /etc/my.cnf (or possibly another location depending on your system defaults), the parameter is datadir .

If your data directory has not yet been initialized (in which case mysqld will complain about missing privilege tables) you can create them like this:

mysql_install_db --datadir=$path_to_new_datadir

Summarizing the answer:

# 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

Notes:
1. The = after datadir - without which commands will fail
2. Full path should be used

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM