Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 08-17-2004, 01:12 AM   #1 (permalink)
bobredcar
Registered User
 
Join Date: Aug 2004
Posts: 4
bobredcar is on a distinguished road
Question New to MySQL - (need help please)

Background
XP Pro, IIS,

Instaled the 'installer' version of MySQL.
I was propted for a uname & pass, but ignored it...
reinstaled MySQL to try and get it again, but no joj?

Problem
When I go to c/mysql/bin and open 'mysql'

I type:mysql> create database redcar;

I get this message:

ERROR 1044: Access denied for user: '@localhost' to database 'redcar'
mysql>

What should I do?
and will I be limited with this version of MySQL?
bobredcar is offline   Reply With Quote
Old 08-17-2004, 05:00 AM   #2 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,487
sde is on a distinguished road
try this:
Code:
mysql -uroot -p
it sould then prompt you for a pass .. make one up and press enter.
__________________
Mike
sde is offline   Reply With Quote
Old 08-17-2004, 07:46 AM   #3 (permalink)
bobredcar
Registered User
 
Join Date: Aug 2004
Posts: 4
bobredcar is on a distinguished road
still a bit stuck!!

Thanks for that, but as I am just starting out.
Could you use real baby terms for me:

what is the format I should type?

mysql -uroot -p

does this mean

go to c:\mysql\bin\mysql at prompt type: mysql -uroot -p;

cause thats what I did, and it didn't work

sorry & thanks

(tell me once and i forget, show me once and i remember)
bobredcar is offline   Reply With Quote
Old 08-17-2004, 08:05 AM   #4 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,487
sde is on a distinguished road
yes, that is what i meant. was the output the same as above? are you sure mysql is running?

question:
1. how exactly did you "open mysql" ?

did you actually get to the "mysql>" prompt? and if so, what username did you login as?
__________________
Mike
sde is offline   Reply With Quote
Old 08-17-2004, 08:23 AM   #5 (permalink)
bobredcar
Registered User
 
Join Date: Aug 2004
Posts: 4
bobredcar is on a distinguished road
loose ends still

No this time the output is:

ERROR 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 'mysql -uroot -p' at line 1
mysql>

I opened sql like this:
My computer, c drive, mysql folder, bin folder, double clicked mysql icon.
in short C:\mysql\bin\mysql.exe

I never used a username

what do you think, should I try the zip version of mysql?
bobredcar is offline   Reply With Quote
Old 08-17-2004, 08:33 AM   #6 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,487
sde is on a distinguished road
oooh
do this:

Start -> Run
Type cmd and press enter

You should see your windows command prompt.

navigate to your mysql/bin directory as so:
Code:
cd c:\mysql\bin
now if you have never logged in before, then you will login as root and set your password at the same time.
Code:
mysql -uroot -p
Enter your password: *****
mysql>
When it prompts you for a password, just make one up that you will use for root.

Now you should be logged in as root and able to create your database.

Let me know how it goes.
__________________
Mike
sde is offline   Reply With Quote
Old 08-17-2004, 04:18 PM   #7 (permalink)
bdl
Senior Contributor
 
Join Date: May 2002
Location: vta.ca.usa
Posts: 555
bdl is on a distinguished road
Quote:

When it prompts you for a password, just make one up that you will use for root.
Actually, using that command will attempt to login as root using a password, but will not set a password; if you've not set a password before, obviously it won't let you in. You want to simply login as 'root', sans password until you decide to create one. The simple method is to utilize 'mysqladmin' utility, just as you might use 'mysql' on the command line.

Code:
c:\mysql\bin\> mysqladmin -u root password 'yournewpassword'
Substitute the password you wish to use with 'yournewpassword' above and you're good to go.


Please see the MySQL manual sections on 'Installing MySQL on Windows', 'Post installation setup and testing', the 'MySQL Tutorial', and the manual entry for mysqladmin.
bdl is offline   Reply With Quote
Old 08-18-2004, 03:21 PM   #8 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,487
sde is on a distinguished road
i was wrong. it used to work like this: mysql -uroot -p<mypassword>

and if you logged in like that the first time , then it would set that as your password.

i just tried the mysqladmin as shown above with mysql 4 and it doesn't change my password. is it only supposed to work the first time?
__________________
Mike
sde is offline   Reply With Quote
Old 08-18-2004, 04:47 PM   #9 (permalink)
bdl
Senior Contributor
 
Join Date: May 2002
Location: vta.ca.usa
Posts: 555
bdl is on a distinguished road
Quote:
Originally posted by sde
i just tried the mysqladmin as shown above with mysql 4 and it doesn't change my password. is it only supposed to work the first time?
Yes, that applies only to the first time you're setting a password, as it assumes no password. If you've already set a password, then you've got to use the '-p' flag in the statement, and provide your current password, just as with any other time you login or utilize mysqladmin.

Change a password after you've already set one:
Code:
mysqladmin -u root -p password 'newpassword'
bdl is offline   Reply With Quote
Old 08-18-2004, 05:23 PM   #10 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,487
sde is on a distinguished road
oh ok.. that is why it wasn't working then. u can do it after you are logged in as root to:
Code:
mysql> set password = password('newpassword');
__________________
Mike
sde is offline   Reply With Quote
Old 08-23-2004, 07:08 AM   #11 (permalink)
bobredcar
Registered User
 
Join Date: Aug 2004
Posts: 4
bobredcar is on a distinguished road
Thanks for your help

Thank you both for your help (sde & bdl), I still could not get it to work (i must be off form) I found this and it seemed to work, thought I would post it.

A.4.1 How to Reset the Root Password

If you have never set a root password for MySQL, the server will not require a password at all for connecting as root. However, it is recommended to set a password for each account. See section 5.4.1 General Security Guidelines.

If you set a root password previously, but have forgotten what it was, you can set a new password. The following procedure is for Windows systems. The procedure for Unix systems is given later in this section.

The procedure under Windows:

Log on to your system as Administrator.
Stop the MySQL server if it is running. For a server that is running as a Windows service, go to the Services manager: Start Menu -> Control Panel -> Administrative Tools -> Services

Then find the MySQL service in the list, and stop it. If your server is not running as a service, you may need to use the Task Manager to force it to stop.
Open a console window to get to the DOS command prompt: Start Menu -> Run -> cmd

We are assuming that you installed MySQL to `C:\mysql'. If you installed MySQL to another location, adjust the following commands accordingly. At the DOS command prompt, execute this command: C:\> C:\mysql\bin\mysqld-nt --skip-grant-tables

This starts the server in a special mode that does not check the grant tables to control access.
Keeping the first console window open, open a second console window and execute the following commands (type each on a single line): C:\> C:\mysql\bin\mysqladmin -u root
flush-privileges password "newpwd"
C:\> C:\mysql\bin\mysqladmin -u root -p shutdown

Replace ``newpwd'' with the actual root password that you want to use. The second command will prompt you to enter the new password for access. Enter the password that you assigned in the first command.
Stop the MySQL server, then restart it in normal mode again. If you run the server as a service, start it from the Windows Services window. If you start the server manually, use whatever command you normally use.
You should now be able to connect using the new password.
bobredcar is offline   Reply With Quote
Old 08-23-2004, 07:47 AM   #12 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,487
sde is on a distinguished road
excellent =) i couldn't get mysqladmin to work and i've never read how to recover a lost password. thanks for posting your results!
__________________
Mike
sde is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
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


Similar Threads
Thread Thread Starter Forum Replies Last Post
MySQL Views sde PHP 1 05-01-2003 12:06 PM
and on to mysql .. sde Linux / BSD / OS X 2 01-18-2003 07:39 PM
MySQL problems sde Linux / BSD / OS X 5 12-07-2002 10:04 PM


All times are GMT -8. The time now is 10:09 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting