View Single Post

   
  #3 (permalink)  
Old 02-28-2008, 06:47 AM
Adam Englander
 
Posts: n/a
Default Re: MySQL and 'ODBC'@'localhost' error

kapil kaushik wrote:
> Hi,
>
> I am very new to MySQL. I have downloaded and installed the "
> mysql-essential-5.0.41-win32.msi" version for Windows XP.
> After installation and instance configuration, the following thing runs
> fine:
>
> mysql -u root -p
> Enter password: *********
>
> -- gets me to the mysql prompt and the following things also work fine
>
> mysql> create database test_dev
> Query OK, 1 row affected <0.00 sec>
> mysql> grant all on test_dev.* to 'root'@'localhost'; (this works fine,
> but
> 'kapil'@'localhost' in its place gives ERROR 1133)
> Query OK, 1 row affected <0.01 sec>
>
> (this means that the mysql server is up and running)
> I then write a small create.sql file, in the child folder db/create.sql:
>
> drop table if exists products;
> create table products (
> id int not null auto_increment,
> primary key (id)
> );
>
> The problem now comes when i write the following command:
> cwd>mysql test_dev <db/create.sql
>
> It now gives me the following error message:
> ERROR 1045 <28000>: Access denied for user 'ODBC'@'localhost' <using
> password: NO>
>
> I have tried looking for some responses online, but most of them said that
> the problem is related to root user and password etc., but I guess I am
> able
> to login to the mysql prompt. I also tried the following ( and got error
> !!):
>
> cwd>mysqladmin ping
> mysqladmin: connect to server at 'localhost' failed
> error: 'Access denied for user 'ODBC'@'localhost' <using password: NO>'
>
> Confused as to what is going on !!
>
> Sorry for making it too long, but just wanted to make it as clear as
> possible from my side. Any help will be most appreciated.
>
> Thanks,
> Kapil
>

You need to append the -u and -p options to all of the commands in order
to use the correct credentials to run the script or mysqldump or any of
the client utilities.

BTW, root has all access to all databases, no need to run the grant for
root.

The grant error when properly logged in is due to the fact that the user
doesn't exist. Add the "identified by 'password'" clause to create the
user or create the user by hand before running the script.

Adam
Reply With Quote