Error while first install I Can't create Table

“Error while trying to initialise the database: An exception occurred while executing a query: SQLSTATE[HY000]: General error: 1005 Can’t create table nextcloud.oc_migrations (errno: 13 “Permission denied”)”
Hallo I got an Error and I tried everything I found to solve it, but of cause it didn’t help.
So the error got send by another dude too: PSA: App Install Permissions Error
I installed Nextcloud on Proxmox with Mysql with this tutorial:
https://www.youtube.com/watch?v=n2Tk0BUMT5U&t=664s
Title if you hate links like me:( Proxmox HomeServer Teil 29 - Installation von Nextcloud 27
Andres Hardware)
Its a Simple Installation and its the same as this in the docs: Example installation on Ubuntu 22.04 LTS — Nextcloud latest Administration Manual latest documentation
I did all steps and I get a SQL error. The SQL User i made has all permissions what user gets used in the last installation step? How can I get this user to have all permissons beside this command “GRANT ALL PRIVILEGES ON nextcloud.* TO ‘username’@‘localhost’;”
I really don’t like to waste time so I looked if someone hat this error before and i found several diffrent kinds of cases but the only one I found beeing the exact same was the one Mentioned in the beginning. Do you have any ideas what i have to do to get the permissons ? And if I am just too stupid to find the right solution or to read a damn manuel please just tell me and point to the right case that solved it. Thanks for your great help and sorry for my englisch I am not native and dislexic

connect to mysql with the command line mysql -u <your user> -p <database name> to see if you can get access, if not, work it from there.

Mysql log is your friend.

Obvious areas to look into:

  • does the database exist? did the create database command created it (check, could have been typos)
  • same for the user, was the user created (that’s why check with cli login)
  • is both your mysql and nextcloud on the same (virtual) machine (ie. localhost)? You’re granting privileges to localhost connections

Don’t give up, with a little bit of investigation, I’m sure you can find the cause. Just check the basics on the database side.

1 Like

The Login via mysql -u -p works without problems.
So the database exists, the user was created. Yes the mysql and nextcloud are on the same VM and the permissions are on localhost.
At least thats what I think is shown in the next thing I tried.
I looked up the permissons for my user: (Chaged up the username to “The Username I used” its hard to read)
MariaDB [(none)]> SHOW GRANTS FOR ‘The Username I used’@‘localhost’; ±---------------------------------------------------------------------------------------------------------------------+ | Grants for The Username I used@localhost | ±---------------------------------------------------------------------------------------------------------------------+ | GRANT USAGE ON . TO The Username I used@localhost IDENTIFIED BY PASSWORD ‘PaswordHash’ | | GRANT ALL PRIVILEGES ON Database I used `.* TO ``The Username I used@localhost | ±---------------------------------------------------------------------------------------------------------------------+ 2 rows in set (0.000 sec)

Now I tried to get a log out of SQL and I cant get SQL back up running. Seen below my the rest of my command.

I changed the conf back to no logging and it still doesn’t work.
So as usual I tried to find the error and I tried to give a view permissons but the errors won’t change.

I think at this point with my skill level i am just making it worse.
I would say “Ich habe es verschlimmbessert”.
So I setup the server from scratch again via another way that seems more on my level: https://www.youtube.com/watch?v=mfbzTgVEVuE
The server will still exist if you’d like to solve my issue. But at this point I feel like starting from scratch is the best option.

I hope you don’t count that as giving up. I am going to try again and again if I need to I am fed up with with paid subscriptions and microsoft and I got fully sold on nextcloud. Thank you very much for answering my request and incuraging me to go on.

Here my errors if someone likes to see:

systemctl start mysql
Job for mariadb.service failed because the control process exited with error code.
See “systemctl status mariadb.service” and “journalctl -xeu mariadb.service” for details.

than i look into those files:
x mariadb.service - MariaDB 10.6.16 database server
Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Fri 2024-04-12 15:36:03 UTC; 53s ago
Docs: man:mariadbd(8)
systemd - MariaDB Knowledge Base
Process: 46397 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld (code=exited, status=0/SUCCESS)
Process: 46398 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
Process: 46400 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= || VAR=cd /usr/bin/..; /usr/bin/galera_recovery; [ $? -eq 0 ] && s>
Process: 46429 ExecStart=/usr/sbin/mariadbd $MYSQLD_OPTS $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION (code=exited, status=1/FAILURE)
Main PID: 46429 (code=exited, status=1/FAILURE)
CPU: 92ms

Apr 12 15:36:03 Nextcloud mariadbd[46429]: 2024-04-12 15:36:03 0 [Note] Plugin ‘FEEDBACK’ is disabled.
Apr 12 15:36:03 Nextcloud mariadbd[46429]: 2024-04-12 15:36:03 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
Apr 12 15:36:03 Nextcloud mariadbd[46429]: 2024-04-12 15:36:03 0 [Note] InnoDB: Buffer pool(s) load completed at 240412 15:36:03
Apr 12 15:36:03 Nextcloud mariadbd[46429]: 2024-04-12 15:36:03 0 [Warning] You need to use --log-bin to make --expire-logs-days or --binlog-expire-logs-secon>
Apr 12 15:36:03 Nextcloud mariadbd[46429]: 2024-04-12 15:36:03 0 [Note] Server socket created on IP: ‘127.0.0.1’.
Apr 12 15:36:03 Nextcloud mariadbd[46429]: 2024-04-12 15:36:03 0 [ERROR] mariadbd: Can’t create/write to file ‘/run/mysqld/mysqld.pid’ (Errcode: 13 "Permissi>
Apr 12 15:36:03 Nextcloud mariadbd[46429]: 2024-04-12 15:36:03 0 [ERROR] Can’t start server: can’t create PID file: Permission denied
Apr 12 15:36:03 Nextcloud systemd[1]: mariadb.service: Main process exited, code=exited, status=1/FAILURE
Apr 12 15:36:03 Nextcloud systemd[1]: mariadb.service: Failed with result ‘exit-code’.
Apr 12 15:36:03 Nextcloud systemd[1]: Failed to start MariaDB 10.6.16 database server.
lines 1-22/22 (END)

x mariadb.service - MariaDB 10.6.16 database server
Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Fri 2024-04-12 15:13:43 UTC; 3s ago
Docs: man:mariadbd(8)

t: enabled)
ago

r/run/mysqld (code=exited, status=0/SUCCESS)
TART_POSITION (code=exited, status=0/SUCCESS)
VAR= || VAR=cd /usr/bin/..; /usr/bin/galera_recovery; [ $? -eq 0 ] && systemctl set-environment _WSREP_START_POSITION=$VAR || exit 1 (code=exited, sta>
R $_WSREP_START_POSITION (code=exited, status=1/FAILURE)

‘FEEDBACK’ is disabled.
Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
Buffer pool(s) load completed at 240412 15:36:03
need to use --log-bin to make --expire-logs-days or --binlog-expire-logs-seconds work.
socket created on IP: ‘127.0.0.1’.
bd: Can’t create/write to file ‘/run/mysqld/mysqld.pid’ (Errcode: 13 “Permission denied”)
start server: can’t create PID file: Permission denied
e=exited, status=1/FAILURE
-code’.
server.
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
– Support: Enterprise open source support | Ubuntu

– A start job for unit mariadb.service has begun execution.

– The job identifier is 13218.
Apr 12 15:36:03 Nextcloud mariadbd[46429]: 2024-04-12 15:36:03 0 [Note] Starting MariaDB 10.6.16-MariaDB-0ubuntu0.22.04.1 source revision as process 46429
Apr 12 15:36:03 Nextcloud mariadbd[46429]: 2024-04-12 15:36:03 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
Apr 12 15:36:03 Nextcloud mariadbd[46429]: 2024-04-12 15:36:03 0 [Note] InnoDB: Number of pools: 1
Apr 12 15:36:03 Nextcloud mariadbd[46429]: 2024-04-12 15:36:03 0 [Note] InnoDB: Using crc32 + pclmulqdq instructions
Apr 12 15:36:03 Nextcloud mariadbd[46429]: 2024-04-12 15:36:03 0 [Note] InnoDB: Using liburing
Apr 12 15:36:03 Nextcloud mariadbd[46429]: 2024-04-12 15:36:03 0 [Note] InnoDB: Initializing buffer pool, total size = 134217728, chunk size = 134217728
Apr 12 15:36:03 Nextcloud mariadbd[46429]: 2024-04-12 15:36:03 0 [Note] InnoDB: Completed initialization of buffer pool
Apr 12 15:36:03 Nextcloud mariadbd[46429]: 2024-04-12 15:36:03 0 [Note] InnoDB: The log sequence number 42664 in the system tablespace does not match the log sequence number 43020 in the ib_logfil>
Apr 12 15:36:03 Nextcloud mariadbd[46429]: 2024-04-12 15:36:03 0 [Note] InnoDB: 128 rollback segments are active.
Apr 12 15:36:03 Nextcloud mariadbd[46429]: 2024-04-12 15:36:03 0 [Note] InnoDB: Removed temporary tablespace data file: “./ibtmp1”
Apr 12 15:36:03 Nextcloud mariadbd[46429]: 2024-04-12 15:36:03 0 [Note] InnoDB: Creating shared tablespace for temporary tables
Apr 12 15:36:03 Nextcloud mariadbd[46429]: 2024-04-12 15:36:03 0 [Note] InnoDB: Setting file ‘./ibtmp1’ size to 12 MB. Physically writing the file full; Please wait 

Apr 12 15:36:03 Nextcloud mariadbd[46429]: 2024-04-12 15:36:03 0 [Note] InnoDB: File ‘./ibtmp1’ size is now 12 MB.
Apr 12 15:36:03 Nextcloud mariadbd[46429]: 2024-04-12 15:36:03 0 [Note] InnoDB: 10.6.16 started; log sequence number 43020; transaction id 16
Apr 12 15:36:03 Nextcloud mariadbd[46429]: 2024-04-12 15:36:03 0 [Note] Plugin ‘FEEDBACK’ is disabled.
Apr 12 15:36:03 Nextcloud mariadbd[46429]: 2024-04-12 15:36:03 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
Apr 12 15:36:03 Nextcloud mariadbd[46429]: 2024-04-12 15:36:03 0 [Note] InnoDB: Buffer pool(s) load completed at 240412 15:36:03
Apr 12 15:36:03 Nextcloud mariadbd[46429]: 2024-04-12 15:36:03 0 [Warning] You need to use --log-bin to make --expire-logs-days or --binlog-expire-logs-seconds work.
Apr 12 15:36:03 Nextcloud mariadbd[46429]: 2024-04-12 15:36:03 0 [Note] Server socket created on IP: ‘127.0.0.1’.
Apr 12 15:36:03 Nextcloud mariadbd[46429]: 2024-04-12 15:36:03 0 [ERROR] mariadbd: Can’t create/write to file ‘/run/mysqld/mysqld.pid’ (Errcode: 13 “Permission denied”)
Apr 12 15:36:03 Nextcloud mariadbd[46429]: 2024-04-12 15:36:03 0 [ERROR] Can’t start server: can’t create PID file: Permission denied
Apr 12 15:36:03 Nextcloud systemd[1]: mariadb.service: Main process exited, code=exited, status=1/FAILURE
– Subject: Unit process exited
– Defined-By: systemd
– Support: Enterprise open source support | Ubuntu

– An ExecStart= process belonging to unit mariadb.service has exited.

– The process’ exit code is ‘exited’ and its exit status is 1.
Apr 12 15:36:03 Nextcloud systemd[1]: mariadb.service: Failed with result ‘exit-code’.
– Subject: Unit failed
– Defined-By: systemd
– Support: Enterprise open source support | Ubuntu

– The unit mariadb.service has entered the ‘failed’ state with result ‘exit-code’.
Apr 12 15:36:03 Nextcloud systemd[1]: Failed to start MariaDB 10.6.16 database server.
– Subject: A start job for unit mariadb.service has failed
– Defined-By: systemd
– Support: Enterprise open source support | Ubuntu

– A start job for unit mariadb.service has finished with a failure.

– The job identifier is 13218 and the job result is failed.
~
~
~
~
~
~
~
lines 313-360/360 (END)

Now the installation with the new tutorial felt too easy its working: