Symptoms
-
The following error is shown on attempt to start MySQL or in MySQL error log.
/var/log/mariadb/mariadb.log
or/var/log/mysql/error.log
on Linux:InnoDB: Error: could not open single-table tablespace file ./db_example/table.ibd
%plesk_dir%DatabasesMySQLdata<server_name>.err
on Windows:InnoDB: Error: could not open single-table tablespace file .db_exampletable.ibd
-
Permissions or ownership on the database file in the aforementioned error differ from the following:
Linux:
# ls -l /var/lib/mysql/db_example/table.ibd
–rw-rw—- 1 mysql mysql 114688 Apr 17 03:02 /var/lib/mysql/db_example/table.ibdWindows:
PS C:UsersAdministrator> Get-Acl “C:Program Files (x86)PleskDatabasesMySQLDatadb_exampletable.ibd” | Format-List
…
Access : NT AUTHORITYSYSTEM Allow FullControl
NT AUTHORITYNETWORK SERVICE Allow FullControl
BUILTINAdministrators Allow FullControl
NT SERVICEMySQL56 Allow FullControl
…
Cause
The database files have incorrect permissions.
Resolution
Linux
-
Connect to the server via SSH
-
Remove the immutable bit if any:
# chattr -i /var/lib/mysql/db_example/*
-
Set correct permissions and ownership on the database files:
# chmod 660 /var/lib/mysql/db_example/*
# chown mysql:mysql /var/lib/mysql/db_example/* -
Restart MySQL service:
# service mysql restart
or
# service mysqld restart
or
# service mariadb restart
Note: The proper command depends on the OS and MySQL version.
Windows
-
Connect to the server via RDP
-
Navigate to
%plesk_dir%DatabasesMySQLData
in Windows Explorer -
Right-click on the
db_example
folder and choose Properties -
Go to Security tab
-
Click the Edit button, then the Add button
-
Choose the necessary user
Note: It can vary depends on the OS and MySQL version. In the example above, it is NT SERVICEMySQL56.
-
Tick the Full control checkbox and click the OK button