In CyberPanel v2.1 (on Ubuntu 18) I have previously installed WordPress successfully on sub-domain using the app installer. Now after a few months I tried the install on a domain and the WP files were downloaded but the database creation failed.
I then tried creating a MySql database in CyberPanel and that failed. I tried the same in PhpMyAdmin and it failed. However I can’t find any error logs on the server with related error messages.
CyberPanel is running on Php 7.2 (which needs updating) and the domain is on 7.4, and the extensions lsphp72-mysql and lsphp74-mysql are both showing in CyberPanel > PHP > Install Extensions as ‘Installed’.
# MariaDB-specific config file.
# Read by /etc/mysql/my.cnf
[client]
# Default is Latin1, if you need UTF-8 set this (also in server section)
#default-character-set = utf8
[mysqld]
#
# * Character sets
#
# Default is Latin1, if you need UTF-8 set all this (also in client section)
#
#character-set-server = utf8
#collation-server = utf8_general_ci
#character_set_server = utf8
#collation_server = utf8_general_ci
# Import all .cnf files from configuration directory
!includedir /etc/mysql/mariadb.conf.d/
Contents of /etc/mysql/mariadb.conf.d/
50-client.cnf 50-mysql-clients.cnf 50-mysqld_safe.cnf 50-server.cnf
I’ve just found this error in the main CyberPanel log:
"You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '-web' at line 1")[createDatabase]
The domain includes a hyphen, it’s something-web.ext, hence ‘-web’ in the error. Something similar here. Maybe CyberPanel is trying to create the database name with the hyphen and it’s being rejected? I wonder if this is fixed in v2.1 build 2 (current is v2.1 build 1)?
Yes I can create a database manually in CyberPanel and PhpMyAdmin if the database name excludes the hyphen!
If I manually create a database after the failed WP install, the database name and user name are prefixed with the first 4 characters of the domain name plus an underscore. However the database name and user name in wp_config (created by the WP app install) have NO prefix, so navigating to the domain shows a database connection error. If I add the prefix then I see the WP install page.