473,657 Members | 2,686 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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\newlan d_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 18456
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\newlan d_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\bi n\mysql -uroot -prootpasswd < newland_tours.s ql

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.c om> 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\newlan d_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\mysq l-installation\bi n\mysql -uroot -prootpasswd < newland_tours.s ql


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\bi n\mysql -uroot -prootpasswd <
newland_tours.s ql

I understand everything here: path\to\mysql-installation\bi n\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********@nee dshelp.com> wrote:
On Sat, 05 Jun 2004 20:59:00 GMT, "Janwillem Borleffs"
<jw@jwscripts.c om> 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\newlan d_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\mysq l-installation\bi n\mysql -uroot -prootpasswd < newland_tours.s ql


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\bi n\mysql -uroot -prootpasswd <
newland_tours.s ql

I understand everything here: path\to\mysql-installation\bi n\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.p hp 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\newlan d_tours.sql

It should not give the same error anymore.

Follow-ups set to mailing.databas e.mysql only
Jul 20 '05 #6
On Sat, 05 Jun 2004 21:20:45 +0100, John <ph********@nee dshelp.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\newlan d_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\newlan d_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\my sql < newland_tours.s ql

Or if you have a password,

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

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.s ql
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****@wheream i.not> wrote:
On Sat, 05 Jun 2004 21:20:45 +0100, John <ph********@nee dshelp.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\newlan d_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\newlan d_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\m ysql < newland_tours.s ql
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\m ysql -u root -p < newland_tours.s ql
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@localhos t" <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.s ql
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.s ql 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
5561
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 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...
0
4578
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 some databases. However granting privileges after setting password seems to reset some Other access,
0
12029
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 Password: '******' I get the following:
2
3248
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 awfully weird. Any ideas? Server Error in '/intranet' Application. ---------------------------------------------------------------------------- ---- Configuration Error
3
4142
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 rinetd, the error message is: ERROR 2013: Lost connection to MySQL server during query Using the exact same query from prompt on several clients (some are SuSE 9.1, some are older Redhat systems, but none are configured
9
106225
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
9077
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 database persmission problem that doesn't allow me to do basically anything but I don't know how go fix it. I also notice that the error message says user ***@localhost when it should really say ***@mysql (because Yahoo! doesn't use "localhost" but...
1
4584
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 the following error. Error 70 : Access Denied. Please anybody can help me.
5
24506
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, EventArgs e) { Exception exception = Server.GetLastError();
1
8512
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8612
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7347
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6175
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5638
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4171
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4329
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2739
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1969
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.