• Hi

    there are errors on front end and can’t login to the backend when database name contains hyphens (MariaDB, PHP7). This stops us even getting into wp-admin / wp-login

    
    WordPress database error: [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 '-database-name' at line 1]
    SHOW TABLE STATUS FROM some-database-name
    

    it needs the database name (and any table names) escaping with backticks

    For now adding backticks around the %s allowed me to get into the site to disable the plugin

    wp-cleanfix/plugin/Modules/Database/DatabaseTablesTest.php Line 26:
    $sql = sprintf( 'SHOW TABLE STATUS FROM%s', DB_NAME );

    thanks
    J

  • The topic ‘breaking mysql error when database name contains hyphens (MariaDB, PHP7)’ is closed to new replies.