If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Default escape character in MySQL

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-27-09, 05:56
amitbora27 amitbora27 is offline
Registered User
 
Join Date: May 2009
Posts: 41
Default escape character in MySQL

what is the default escape character in MySQL?

We have in ORACLE like ' " ', in MSSQL like ' [] ' which is used while creating table.

MSSQL
create table [aa/njh] (col1 INT);

ORACLE
create table "aa/njh" (col1 INT);


If I use both( ", []) in MYSQL while create table it is not working fine.
My aim is to have table name with special character on numeric.

Also
What is the default schema name in MySQL 5.1.34 like in ORACLE is username (system), in MSSQL is "dbo"?


I think it is database name Isn't it?
Reply With Quote
  #2 (permalink)  
Old 05-27-09, 06:06
ashish_mat1979 ashish_mat1979 is offline
Registered User
 
Join Date: Aug 2005
Posts: 30
" ` " is used as escape character in MySql if you want to use special characters in table name or field name or want to use any reserved word of mysql as table name.

Create table `aa/njh` (col1 INT);
__________________
Ashish
Entertainment Overloaded
Reply With Quote
  #3 (permalink)  
Old 05-27-09, 06:06
amitbora27 amitbora27 is offline
Registered User
 
Join Date: May 2009
Posts: 41
i got solution as :

mysql> CREATE TABLE "test" (col INT);
ERROR 1064: You have an error in your SQL syntax...
mysql> SET sql_mode='ANSI_QUOTES';
mysql> CREATE TABLE "test" (col INT);
Query OK, 0 rows affected (0.00 sec)
Reply With Quote
  #4 (permalink)  
Old 05-27-09, 06:08
amitbora27 amitbora27 is offline
Registered User
 
Join Date: May 2009
Posts: 41
We can't use " ' " in create table for table name. used for column name.

I got the solution as posted below.
Reply With Quote
  #5 (permalink)  
Old 05-27-09, 06:09
amitbora27 amitbora27 is offline
Registered User
 
Join Date: May 2009
Posts: 41
mysql> create table 'p1/sdre' (col1 int);
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 ''p1/s
dre' (col1 int)' at line 1

See given solution.
Reply With Quote
  #6 (permalink)  
Old 05-27-09, 06:20
amitbora27 amitbora27 is offline
Registered User
 
Join Date: May 2009
Posts: 41
Yes Ashish we can use this also without setting ANSI.
Reply With Quote
  #7 (permalink)  
Old 06-04-09, 02:58
amitbora27 amitbora27 is offline
Registered User
 
Join Date: May 2009
Posts: 41
Hi

I am trying to connect to MySQL database. But it is giving me error as
"ERROR 1130: Host '' is not allowed to connect to this MySQL server"

mysql>musql -h 'a.b.c.d' -u root -p
Enter password: ********

"ERROR 1130: Host 'a.b.c.d' is not allowed to connect to this MySQL server"

Also I tried to do the following :

mysql> create user 'root'@'a.b.c.d' identified by 'root';
Query OK, 0 rows affected (0.00 sec)

mysql> grant all privileges on *.* to 'root'@'a.b.c.d' with gran
t option;
Query OK, 0 rows affected (0.00 sec)

mysql> show grants for 'root'@'a.b.c.d';
+-------------------------------------------------------------------------------
-----------------------------------------------------------------------+
| Grants for root@a.b.c.d
|
+-------------------------------------------------------------------------------
-----------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'root'@'a.b.c.d' IDENTIFIED BY
PASSWORD '*81F5E21E35407D884A6CD4A731AEBFB6AF209E1B' WITH GRANT OPTION |
+-------------------------------------------------------------------------------
-----------------------------------------------------------------------+
1 row in set (0.00 sec)

>exit

Again trying from begining

>mysql -h a.b.c.d -u root –p
Enter password: ********
ERROR 1045 (28000): Access denied for user 'root'@'ps4743.persistent.co.in' (usi
ng password: YES)


Can you please tell me if anything goes wrong?
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On