473,385 Members | 1,630 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Error 1044 Access denied to database

Hello.

I am currently working through a book on Dreamweaver and using PHP. I
am having a little trouble with setting up the database though. I
have php 4.2.3 and MySQL 4.0.20a. I am running locally with Apache
1.3.27 on Windows XP Pro.

I seem to have finally got MySQL running after a lot of difficulty.
In the book it says to type source C:\mysql\newland_tours.sql at the
mysql> prompt, to generate the newland_tours database in my copy of
MySQL.

When I do this however it gives me an error message saying:

Error 1044 Access denied for user: '@localhost' to database
'newland_tours'

and numerous other ones saying:

Error 1046 No Database Selected

If you can help me I'd be very grateful. I think that something must
be wrong or amiss with the settings or the paths to the files in
my.ini file? Or perhaps it is just a bug with php or MySql?

Thanks very much for any help

John
Jul 20 '05 #1
8 18428
John wrote:
I seem to have finally got MySQL running after a lot of difficulty.
In the book it says to type source C:\mysql\newland_tours.sql at the
mysql> prompt, to generate the newland_tours database in my copy of
MySQL.

When I do this however it gives me an error message saying:

Error 1044 Access denied for user: '@localhost' to database
'newland_tours'


Make sure that the correct user is defined in mysql and supply it, e.g.:

path\to\mysql-installation\bin\mysql -uroot -prootpasswd < newland_tours.sql

For more info on priveleges, see:

http://dev.mysql.com/doc/mysql/en/De...rivileges.html and
http://dev.mysql.com/doc/mysql/en/GRANT.html
JW

Jul 20 '05 #2
On Sat, 05 Jun 2004 20:59:00 GMT, "Janwillem Borleffs"
<jw@jwscripts.com> wrote:
John wrote:
I seem to have finally got MySQL running after a lot of difficulty.
In the book it says to type source C:\mysql\newland_tours.sql at the
mysql> prompt, to generate the newland_tours database in my copy of
MySQL.

When I do this however it gives me an error message saying:

Error 1044 Access denied for user: '@localhost' to database
'newland_tours'

Make sure that the correct user is defined in mysql and supply it, e.g.:

path\to\mysql-installation\bin\mysql -uroot -prootpasswd < newland_tours.sql


How exactly do I define correct user and supply it?

When I go to the mysql> prompt do I type in what you have put?

path\to\mysql-installation\bin\mysql -uroot -prootpasswd <
newland_tours.sql

I understand everything here: path\to\mysql-installation\bin\mysql

but I don't have a clue about this: -uroot -prootpasswd <
For more info on priveleges, see:

http://dev.mysql.com/doc/mysql/en/De...rivileges.html and
http://dev.mysql.com/doc/mysql/en/GRANT.html


I have taken a look at these links and all the different sections and
subsections, but it is far too complex for me. I am just a beginner.
I need it explained simply what to do.

Cheers

John
Jul 20 '05 #3
In article <gb********************************@4ax.com>,
John <ph********@needshelp.com> wrote:
On Sat, 05 Jun 2004 20:59:00 GMT, "Janwillem Borleffs"
<jw@jwscripts.com> wrote:
John wrote:
I seem to have finally got MySQL running after a lot of difficulty.
In the book it says to type source C:\mysql\newland_tours.sql at the
mysql> prompt, to generate the newland_tours database in my copy of
MySQL.

When I do this however it gives me an error message saying:

Error 1044 Access denied for user: '@localhost' to database
'newland_tours'


Make sure that the correct user is defined in mysql and supply it, e.g.:

path\to\mysql-installation\bin\mysql -uroot -prootpasswd < newland_tours.sql


How exactly do I define correct user and supply it?

When I go to the mysql> prompt do I type in what you have put?

path\to\mysql-installation\bin\mysql -uroot -prootpasswd <
newland_tours.sql

I understand everything here: path\to\mysql-installation\bin\mysql

but I don't have a clue about this: -uroot -prootpasswd <
For more info on priveleges, see:

http://dev.mysql.com/doc/mysql/en/De...rivileges.html and
http://dev.mysql.com/doc/mysql/en/GRANT.html


I have taken a look at these links and all the different sections and
subsections, but it is far too complex for me. I am just a beginner.
I need it explained simply what to do.

Cheers

John


Buy a book on MySQL and read it. It's whole other rathole in addition
to php. You'll need to understand what a real DBMS is doing and how it
does it. It's not trivial. Be ready for your brain to turn to tapioca
and leak out your ears.

--
DeeDee, don't press that button! DeeDee! NO! Dee...

Jul 20 '05 #4
On Sat, 05 Jun 2004 22:59:01 -0700, "Michael Vilain
<vi****@spamcop.net>" wrote:
Buy a book on MySQL and read it. It's whole other rathole in addition
to php. You'll need to understand what a real DBMS is doing and how it
does it. It's not trivial. Be ready for your brain to turn to tapioca
and leak out your ears.


I already have two books.

John
Jul 20 '05 #5
John wrote:
If you can help me I'd be very grateful. I think that something must
be wrong or amiss with the settings or the paths to the files in
my.ini file? Or perhaps it is just a bug with php or MySql?


It is not a bug, and it has nothing to do with php, so alt.php,
alt.comp.lang.php and comp.lang.php groups are not concerned about this
problem.

And even if this would be problem for php also, don't post to several
different newsgroups. Pick one group and one group only and post your
question to there. If you fail to get help from there, think again was
the group selection good or bad and did you ask the question properly.
If you think yes, then you can try another group. Why you should do
this? Because many people don't usually even bother to answer people who
post the question into many newsgroups, because it is against the
netiquette. This is only a friendly advice, because you might not know
this "rule". Don't be offended by me reminding it.

Now, to your problem.

When you installed MySQL you had a root account at the very beginning.
You might have changed the password for it, but if you havent, the
password is empty. The root user has privileges to do anything in the
database, while test user (which is the user you seem to have logged in,
has privileges only in the "test" database.) Try to start your mysql
console program like this:

mysql -u root

If you can get in, you don't have a root password, but that doesn't
matter with this problem. When you get in, try to type the command you
tried earlier:

source C:\mysql\newland_tours.sql

It should not give the same error anymore.

Follow-ups set to mailing.database.mysql only
Jul 20 '05 #6
On Sat, 05 Jun 2004 21:20:45 +0100, John <ph********@needshelp.com>
wrote:

I seem to have finally got MySQL running after a lot of difficulty.
In the book it says to type source C:\mysql\newland_tours.sql at the
mysql> prompt, to generate the newland_tours database in my copy of
MySQL.


I remember how confusing rhis can be. Before you start loading
databases, you need to know exactly how to log in at the mysql command
line. It gets confusing right there because you log in a bit
differently depending on whether or not you set up a user & password.

First off, you need to see if you can log in correctly. So, open your
Command Prompt and cd to the mysql/bin directory. On my machine, it's:

C:\> cd c:\mysql\bin

Once you get to the correct directory, try logging in without any
username or password like this:

C:\mysql\bin\> mysql

That will log you in as the root user if you haven't already set up a
password for root. If you have set a password up, then you can log in
with it like this:

C:\mysql\bin> mysql -u root -p

And then mysql will prompt you for the root password. The -u stands
for "user", which in this case is root. To log in as egghead, type:

C:\mysql\bin> mysql -u egghead -p

The -p means: prompt me for a password.

Now you can get your database loaded up. It will be easier for you if
you copy the C:\mysql\newland_tours.sql file to the mysql\bin
directory. Once you've done that, cd to the mysql\bin directory as if
you were going to log in, and do this:

C:\mysql\bin\mysql < newland_tours.sql

Or if you have a password,

C:\mysql\bin\mysql -u root -p < newland_tours.sql

And enter the password when prompted. If all goes well, you'll get
dumped back to the original prompt with no messages.

If you get errors, and you probably will:

Check that the database already exists. If not, then log in and create
it.

If it says "No database selected", open up the newland_tours.sql
file in notepad, and on the top line type:

USE DATABASE newland_tours;

or whatever the database name is. That should do it!

Jul 20 '05 #7
Sounds like theres not telling it what user to use - if you haven't set
on up you should be able to use the root user (root@localhost) - as an
aside why not just use easyPHP to set up mysql/apache - it take five
minutes??)
Jul 20 '05 #8
On Sun, 06 Jun 2004 19:09:22 GMT, bill <wh****@whereami.not> wrote:
On Sat, 05 Jun 2004 21:20:45 +0100, John <ph********@needshelp.com>
wrote:

I seem to have finally got MySQL running after a lot of difficulty.
In the book it says to type source C:\mysql\newland_tours.sql at the
mysql> prompt, to generate the newland_tours database in my copy of
MySQL.

I remember how confusing rhis can be. Before you start loading
databases, you need to know exactly how to log in at the mysql command
line. It gets confusing right there because you log in a bit
differently depending on whether or not you set up a user & password.

First off, you need to see if you can log in correctly. So, open your
Command Prompt and cd to the mysql/bin directory. On my machine, it's:

C:\> cd c:\mysql\bin


No probs so far
Once you get to the correct directory, try logging in without any
username or password like this:

C:\mysql\bin\> mysql
Yes when I type this I get the "welcome to the mysql monitor" message
and leaves me at a mysql> sign.
That will log you in as the root user if you haven't already set up a
password for root. If you have set a password up, then you can log in
with it like this:
This is quite strange because when I click on the traffic lights
signal in my taskbar and click show me to open up the MySqlAdmin
interface, and then click on the myini setup tab in there it says
user=house and it has a password that is familiar to me.
C:\mysql\bin> mysql -u root -p

And then mysql will prompt you for the root password. The -u stands
for "user", which in this case is root. To log in as egghead, type:

C:\mysql\bin> mysql -u egghead -p

The -p means: prompt me for a password.

Now you can get your database loaded up. It will be easier for you if
you copy the C:\mysql\newland_tours.sql file to the mysql\bin
directory.
I have copied to this directory as well.
Once you've done that, cd to the mysql\bin directory as if
you were going to log in, and do this:
If I try to CD to that directory from the mysql> after logging in it
gives me errors saying unknown command '\m' and '\b' To be able to CD
to that directory again I have to exit from the mysql monitor by
typing exit or \q and it returns me to the c:\mysql\bin> prompt.
C:\mysql\bin\mysql < newland_tours.sql
If I type this now from the c:\mysql\bin> prompt, it gives me an error
saying:

Error 1044 at line 1, access denied for user "@localhost" to database
'database'
Or if you have a password,

C:\mysql\bin\mysql -u root -p < newland_tours.sql
If I try this with the username and password that are listen in the
my.ini file I get the following error:

Error 1045: Access denied for user: 'house@localhost" <using password:
yes>
And enter the password when prompted. If all goes well, you'll get
dumped back to the original prompt with no messages.

If you get errors, and you probably will:

Check that the database already exists. If not, then log in and create
it.
Yes it exists in both the mysql and the mysql\bin folders on drive C.
If it says "No database selected", open up the newland_tours.sql
file in notepad, and on the top line type:

USE DATABASE newland_tours;
Even after typing this on the first line of the newland_tours.sql file
I still get the same error messages.
or whatever the database name is. That should do it!

John
Jul 20 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: John | last post by:
Hello. I am currently working through a book on Dreamweaver and using PHP. I am having a little trouble with setting up the database though. I have php 4.2.3 and MySQL 4.0.20a. I am running...
0
by: Morten Gulbrandsen | last post by:
Hi programmers, Good morning ;-) I think something is wrong, Running windows I believe first I have to set some password, Which creates some user, Then I can grant the required privileges, for...
0
by: Ike_strong | last post by:
Can anyone help me to figure out why each time I try to access my database using: c:\mysql\bin\inmysql -root -p and afterwards:(i.e. after inputting my at the password prompt) Enter...
2
by: Brent | last post by:
Hi, I keep getting this error intermittently. I can compile many times, and run fine, and then one compile/run of it, out of nowhere I get this. If I restart the computer it fixes it, but it seems...
3
by: dstewart | last post by:
Situation: One common MySQL database server on SuSE 9.1 with all updates. Uses 'rinetd'. Has entries for the appropriate IP addresses of all servers. NOTE: If the appropirate entries are NOT in...
9
by: blacksmoke | last post by:
I got an error... when i wants to create database "usersinfo" Username is 'blacksmoke'... Commandline argumments are: mysql> select user(); : e.g., blacksmoke@localhost -------
1
by: gasernag | last post by:
I just installed MySQL and phpMyAdmin in Yahoo! webhosting but when I try to create a table I get the error message: #1044-Access denied for user ****@localhost to _DBNAME_. I am sure I have a...
1
by: Shun | last post by:
Hello, Please anybody try to execute this code. I am having a "quick.html" with email Id and name etc..., and henext form is the below "gdform.asp". When i try to execute this i am getting...
5
by: rote | last post by:
I'm using ASP.NET 2.0 and i have copied and pasted the code below to my Global.asax file but it desn't trap the error I want to trap the 401 access denied void Application_Error(object sender,...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.