-2
MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| admin_default      |
| information_schema |
| mysql              |
| openvpn-admin      |
| performance_schema |
| roundcube          |
+--------------------+
6 rows in set (0.00 sec)

MariaDB [(none)]> drop database 'openvpn-admin';
ERROR 1064 (42000): 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 ''openvpn-admin'' at line 1
MariaDB [(none)]> drop database openvpn-admin;
ERROR 1064 (42000): 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 '-admin' at line 1
MariaDB [(none)]>

I'm triggered. mariadb + vestacp i cannot delete database WHY? what's goin on???

user2177459
  • 97
  • 3
  • 9
  • 1
    As soon as soon as I saw "I'm triggered", I knew this was going to be a bad post. Remove the lorem ipsum and actually paste the error that you are getting rather than a screenshot. – Ryan Schaefer Apr 17 '18 at 22:45
  • I cannot see the text in the image! im using mobile phone. pls post it as a text – jose_bacoy Apr 17 '18 at 22:55

1 Answers1

5

It's down to your use of "-" in the schema name.

You quote identifiers with backticks ` or double quotes " (if you have ANSI_QUOTES sql_mode enabled) so it will work with

drop database `openvpn-admin`;
Paul Campbell
  • 1,906
  • 2
  • 12
  • 19
  • GOSH tahnk you very much. setup sql mode directly in command line through SSH. mysql -u root --sql-mode ANSI_QUOTES; or
    SET sql_mode = 'modes'; or SET GLOBAL sql_mode = 'modes'; smt like that.
    – user2177459 Apr 18 '18 at 15:39
  • I'd set it in config so it survives a restart. Have to say I'm not a fan of ANSI_QUOTES they make it much harder to read the code, I only added that to the answer for the sake of completeness. – Paul Campbell Apr 18 '18 at 17:23