Just trying out ubuntu server on my pc and have been testing some commands including mysql. I'm not sure why phpMyAdmin permitted me to create a database like this 'testing?db'. I'm trying to drop this database via SSH but I get this error:
mysql> show databases
-> ;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| phpmyadmin |
| testing?db |
| testing_db |
| wp |
+--------------------+
6 rows in set (0.00 sec)
mysql> DROP DATABASE testing?db;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?db' at line 1
mysql>
I tried creating a database with a '?' in it and it also gives me syntax error. via ssh.
so how do I remove this database?
Try:
DROP DATABASE `testing?db`;
Related
I'm baffled by the problem I'm having. I created a database, created a user, and want to grant the user all privileges on the database. One way or another, I'm having syntax errors, while I'm fairly sure there is no syntax error.
MariaDB [(none)]> SELECT User FROM mysql.user;
+------------+
| User |
+------------+
| osticket |
| phpmyadmin |
| root |
+------------+
3 rows in set (0.00 sec)
MariaDB [(none)]> SHOW DATABASES;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| osticket |
| performance_schema |
| phpmyadmin |
+--------------------+
5 rows in set (0.00 sec)
MariaDB [(none)]> GRANT ALL PRIVILEGES ON 'osticket'.* TO 'osticket'#localhost;
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 ''osticket'.* TO 'osticket'#localhost' at line 1
MariaDB [(none)]>
I also changed localhost to 'localhost' to be sure, no avail. What's going on here?
GRANT ALL PRIVILEGES ON `osticket`.* TO 'osticket'#localhost;
be aware of the quotations
`osticket`.*
I have create a mysql database locally in the unix macos Mojave environment, when entering mysql and entering command
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| cms_blog |
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+
5 rows in set (0.00 sec)
then when entering sequelpro I attempt to connect to 'cms_blog'
Host: 127.0.0.1
default root and password for mysql
This is the error I am seeing
I'm wondering if because the database has no tables I am seeing this error, or because sequelpro may be looking to a mamp mysql conf file rather than the homebrew mysql I am using via cli. Any information would be greatly appreciated.
I'm trying to get more familiar with using command line.. so i'm kind of new.
How would i update this field 'value' from 1 to 0?
mysql> SELECT * FROM core_config_data WHERE path = 'web/seo/use_rewrites'
-> ;
+-----------+---------+----------+----------------------+-------+
| config_id | scope | scope_id | path | value |
+-----------+---------+----------+----------------------+-------+
| 18 | default | 0 | web/seo/use_rewrites | 1 |
+-----------+---------+----------+----------------------+-------+
1 row in set (0.01 sec)
I tried this update statement but it didn't work:
UPDATE core_config_data SET value='0' WHERE config_id=18;
I threw this error in command line:
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHEREc WHERE config_id=18' at line 1
mysql> help;
1064 - You have an error in your SQL syntax; check the manual that corresponds to
your MySQL server version for the right syntax to use near '' at line 1
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| cppp |
| db_byb_develop |
| mysql |
| test |
| train |
+--------------------+
6 rows in set
mysql> status
-> ;
1064 - You have an error in your SQL syntax; check the manual that corresponds to
your MySQL server version for the right syntax to use near 'status' at line 1
Its
SHOW STATUS;
not just
status ;
https://dev.mysql.com/doc/refman/5.0/en/show-status.html
I am trying to create a database with a '-' in between two words and it should work perfectly fine but it isn't. here is the log file:
mysql> create database test1;
Query OK, 1 row affected (0.00 sec)
mysql> show databases
-> ;
+-----------------------+
| Database |
+-----------------------+
| information_schema |
| mifos |
| mifosplatform_tenants |
| mifostenant |
| mifostenant_default |
| mysql |
| performance_schema |
| sakila |
| test |
| test1 |
| testing |
| world |
+-----------------------+
12 rows in set (0.00 sec)
mysql> create database test1-mohit;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near '-mohi
t' at line 1
you can use _(underscore)
create database test1_mohit;
or try this
create database `test1_mohit`;
These both will work
Use one of these character for naming database [0-9,a-z,A-Z$_]
Reference: http://dev.mysql.com/doc/refman/5.0/en/identifiers.html