By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,687 Members | 2,065 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,687 IT Pros & Developers. It's quick & easy.

Command Line Client vs DOS Prompt

P: n/a
I'm a newbie to MySQL and am really confused about when I should be using
the Command Line Client and when the DOS prompt.

I'm using Windows XP and I've just installed MySQL 4.1.10.

I can use the Command Line Client to logon as 'root'. It prompts me for a
password and then I can create databases, etc. from the mysql prompt.
However, if I wanted to logon as a different user, I'm not sure how to do
it.

The MySQL Manual suggests that I should be able to do this sort of thing at
the C:\ prompt. But all I get there is a message: "Access denied for user
'ODBC' @ 'localhost' (using password: NO)". I've made sure that the PATH is
set up correctly.

Why can't I use the C:\ prompt?

Paul.
Jul 23 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
Paul Deverson wrote:
The MySQL Manual suggests that I should be able to do this sort of thing at
the C:\ prompt. But all I get there is a message: "Access denied for user
'ODBC' @ 'localhost' (using password: NO)". I've made sure that the PATH is
set up correctly.


Hard to tell what you are doing wrong without seeing what you are doing.
Let me show an example. Komments marked with # in the example.

# I start as a root user from mysql and create new account for me
mysql> grant all on lamyle.* to testuser@localhost identified by 'password';
Query OK, 0 rows affected (0.00 sec)

# I quit the mysql, to go back to console
# (which you call DOS promt
mysql> exit
Bye

# I'm in the mysql\bin folder and start mysql-console program
C:\mysql\bin>mysql -u testuser -p
Enter password: ********
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3 to server version: 4.1.7

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

# status-command shows the username (there should be other ways
# to check that also)
mysql> status
--------------
mysql Ver 14.7 Distrib 4.1.7, for Win95/Win98 (i32)

Connection id: 3
Current database:
# This line tells me that I am logged in as a correct user,
# called testuser
Current user: testuser@localhost

< Rest of the print is removed >
Jul 23 '05 #2

P: n/a
Thanks for your help.

1st part OK. I created a new database and then granted privileges to a new
user with a password.

I then quit the MySQL Command Line Client and opened my Command Prompt.

At the C:\ prompt I typed
mysql

I got the same "Access denied..." statement.

Nothing I tried here got me past this denied access. (BTW, are you really
inserting a ">" ?).

Back in the MySQL Command Line Client I tried the status command I got a
similar output to you. But it was based on root@localhost which is not
surprising as I can only logn with my original root password.

BTW, because it's version 4.1.10, it's installed itself into C:\Program
Files\MySQL\MySQL Server 4.1\bin but my PATH allows for that.

Paul.
"Aggro" <sp**********@yahoo.com> wrote in message
news:vZ***************@read3.inet.fi...
Paul Deverson wrote:
The MySQL Manual suggests that I should be able to do this sort of thing
at the C:\ prompt. But all I get there is a message: "Access denied for
user 'ODBC' @ 'localhost' (using password: NO)". I've made sure that the
PATH is set up correctly.


Hard to tell what you are doing wrong without seeing what you are doing.
Let me show an example. Komments marked with # in the example.

# I start as a root user from mysql and create new account for me
mysql> grant all on lamyle.* to testuser@localhost identified by
'password';
Query OK, 0 rows affected (0.00 sec)

# I quit the mysql, to go back to console
# (which you call DOS promt
mysql> exit
Bye

# I'm in the mysql\bin folder and start mysql-console program
C:\mysql\bin>mysql -u testuser -p
Enter password: ********
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3 to server version: 4.1.7

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

# status-command shows the username (there should be other ways
# to check that also)
mysql> status
--------------
mysql Ver 14.7 Distrib 4.1.7, for Win95/Win98 (i32)

Connection id: 3
Current database:
# This line tells me that I am logged in as a correct user,
# called testuser
Current user: testuser@localhost

< Rest of the print is removed >

Jul 23 '05 #3

P: n/a
Paul Deverson wrote:
At the C:\ prompt I typed
mysql
Don't type just mysql, or it will try to login anonymously. You should type:
mysql -u yourusername -p

Where -p means that you will be asked for a password.
I got the same "Access denied..." statement.

Nothing I tried here got me past this denied access. (BTW, are you really
inserting a ">" ?).
No, the > in "C:\mysql\bin>mysql -u testuser -p" is just automaticly
inserted character in my console. so if I don't type anything, it says:
"C:\mysql\bin>" on my console.
BTW, because it's version 4.1.10, it's installed itself into C:\Program
Files\MySQL\MySQL Server 4.1\bin but my PATH allows for that.


I think you can tell 4.1 where to install itself. You have propably
installed it to default location, but that shouldn't matter.
Jul 23 '05 #4

P: n/a
I've just tried again. At the command prompt I've changed directories and
got to C:\Program Files\MySQL\MySQL Server 4.1\bin>.

Without pressing enter, I've added "mysql -u mynewusername -p"

I was prompted for a password but when I entered the password corresponding
to the new username, I got:

Error 2003 (HY000): Can't connect to MySQL server on 'localhost' (10061)

I tried it again using "root" instead of my new user name and was again
prompted for a password. I entered the password corresponding to my root
login. I got the same error message.

Paul.
"Aggro" <sp**********@yahoo.com> wrote in message
news:1K**************@read3.inet.fi...
Paul Deverson wrote:
At the C:\ prompt I typed
mysql


Don't type just mysql, or it will try to login anonymously. You should
type:
mysql -u yourusername -p

Where -p means that you will be asked for a password.
I got the same "Access denied..." statement.

Nothing I tried here got me past this denied access. (BTW, are you
really inserting a ">" ?).


No, the > in "C:\mysql\bin>mysql -u testuser -p" is just automaticly
inserted character in my console. so if I don't type anything, it says:
"C:\mysql\bin>" on my console.
BTW, because it's version 4.1.10, it's installed itself into C:\Program
Files\MySQL\MySQL Server 4.1\bin but my PATH allows for that.


I think you can tell 4.1 where to install itself. You have propably
installed it to default location, but that shouldn't matter.

Jul 23 '05 #5

P: n/a
Paul Deverson wrote:
Error 2003 (HY000): Can't connect to MySQL server on 'localhost' (10061)


Do you have the server running? Can you see any processes called mysqld
in your process list?
Jul 23 '05 #6

P: n/a
You're a genius!

I set MySQL up as a service and now it's working perfectly.

Thank you very much indeed.

Paul.
"Aggro" <sp**********@yahoo.com> wrote in message
news:Mk*************@read3.inet.fi...
Paul Deverson wrote:
Error 2003 (HY000): Can't connect to MySQL server on 'localhost' (10061)


Do you have the server running? Can you see any processes called mysqld in
your process list?

Jul 23 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.