0
amit_27's Avatar, Join Date: May 2009
Go4Expert Member
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)
0
pradeep's Avatar, Join Date: Apr 2005
Team Leader
Default escape character is '`' (backtick)
0
amit_27's Avatar, Join Date: May 2009
Go4Expert Member
Yes it is working fine.
0
amit_27's Avatar, Join Date: May 2009
Go4Expert Member
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?
0
pradeep's Avatar, Join Date: Apr 2005
Team Leader
Code: SQL
GRANT ALL privileges ON *.* TO 'root'@'%' WITH GRANT OPTION;
0
amit_27's Avatar, Join Date: May 2009
Go4Expert Member
I have installed MySQl using "mysql-essential-5.1.34-win32.msi". I have installed server so no need of client seperately.

While i trying to connect in my application using "mysql_real_connect() it is giving me error like:
ERROR 162 DB command failed (MDS_E_MYSQL_DB_CONNECT: Client does not support authentication protocol requested by server; consider upgrading MySQL client) - MySQL_Error='1251'

I am not understood why it is telling to upgrade client.

Can you please take the honor to get rid of this problem?
0
amit_27's Avatar, Join Date: May 2009
Go4Expert Member
Resolved the problem.

Thanks Pradeep for answering me.
0
amit_27's Avatar, Join Date: May 2009
Go4Expert Member
Hi,

I am trying to fire a query in MyLSQ 5.1.34 like

mysql> select table_schema from INFORMATION_SCHEMA.TABLES where table_name='table11';

Empty set (0.08 sec)

where table11 is not present in the INFORMATION_SCHEMA.TABLES.

I am expecting the error as table not found but as it is returning the empty set.

I tried to fire a query using mysql_real_query() API. How would I get the correct result as table not found?

Or any other ways to achieve same?
0
pradeep's Avatar, Join Date: Apr 2005
Team Leader
"Select * from table_not_present" will give an error.
0
amit_27's Avatar, Join Date: May 2009
Go4Expert Member
Yes it is giving the correct result.

However I have written an application in which input is table name and need to get the database name (table_schema) from INFORMATION_SCHEMA.TABLES.

So I can't write the query using table_not_found.

Or DO I need to use other API instead of mysql_real_query().
I have seen that in other implementation of ORACLE they used commands in ORACLE to fire SQL like

1. OCIHandleAlloc
2. //Prepare for the query execution
ret = OCIStmtPrepare()

3. ret = OCIAttrGet()

4. ret = OCIStmtExecute()

5. OCIDefineByPos()


Like this If I need to prepare for MySQL which API I need to use.