473,657 Members | 2,625 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 17 '05 #1
10 5560
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 17 '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 17 '05 #3

"John" <ph********@nee dshelp.com> wrote in message
news:gb******** *************** *********@4ax.c om...
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


What Janwillem Borleffs meant was this: Suppose your username for mysql is
"John" and your password is "bafooey", when you're starting up MySQL in the
prompt, type this:

path\to\mysql-installation\bi n\mysql -uJohn -pbafooey

However you may not have created any usernames/passwords for MySQL yet... if
this is the case, type this at the prompt instead:

path\to\mysql-installation\bi n\mysql -uroot -p

This will log you in as the root user (the root user is the user with access
to all databases and all tables within the databases). Once mysql is open
then type this:

\u mysql

^that selects the MySQL database where you can create users. to create a
user type this:

GRANT ALL ON newland_tours.* TO John@localhost IDENTIFIED BY "bafooey";

^^ that command creates the user John with password "bafooey". the
"newland_tours. *" means that the user John has access to all tables in the
newland_tours database (the * means all tables). Once you have created this
user, you can use it to work on the newland_tours database and not have
access problems.

hope this helped

- JP
Jul 17 '05 #4
What Janwillem Borleffs meant was this: Suppose your username for mysql is
"John" and your password is "bafooey", when you're starting up MySQL in the
prompt, type this:
I think that MySql already starts up automatically when my system is
switched on as I have a traffic lights icon in the system tray which
is on green?
path\to\mysq l-installation\bi n\mysql -uJohn -pbafooey
When I type this with the username and password that were created in
the my.ini file it gives the following:

Outfield Disabled.
ERROR:
Unknown command '\m'.
ERROR:
Unknown command '\b'.
ERROR:
Unknown command '\m'.

However you may not have created any usernames/passwords for MySQL yet... if
this is the case, type this at the prompt instead:

path\to\mysq l-installation\bi n\mysql -uroot -p


If I try this without username and password it gives the same error as
before.

MySql is so frustrating to set up it's unbelievable.

John
Jul 17 '05 #5
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 17 '05 #6
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 17 '05 #7
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 17 '05 #8
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 17 '05 #9
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 17 '05 #10

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

Similar topics

3
3126
by: c_chen | last post by:
Hi, i am a beginner in PHP and mySQL. Whenever I try to connect my php and mysql database, i get this error.: MySQL error : access denied for myuser@localhost (Using password:yes) I have created a database called mydatabase at the SQLmonitor, mySQL> create database mydatabase; then i try to grant the access to mydatabase by mySQL>GRANT usage on mydatabase.* to myuser@localhost;
0
2190
by: Carl B. Constantine | last post by:
I'm trying to move a database from one machine to another. I dumped the database and successfully loaded it on one machine, but I can't do it on another machine. I have the database set up. I created the user to access the database, and gave all privs with grant option for that database. But when I go to run the command to restore the database, I get the following error: $ mysql -u user -p database < database.sql Enter password:
8
18456
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
2363
by: Von Bailey | last post by:
I am new to MySQL and I have having a problem creating databases. First some preliminaries... Operating System - Windows XP Professional MySQL Version - 4.0.20a-debug Installed in "Services" to automatically start I don't know if there's anything else need, if there is please let me know. Regardless, on to my problem.
0
1449
by: redfez | last post by:
I just installed mysql-max-4.0.20-sun-solaris2.8-sparc and ran the mysql_install_db script. I try to access a mysql db using a Lisp app that accesses the myodbc driver through our Lisp's odbc interface, AllegroODBC. This used to work fine under mysql-3.23.52-sun-solaris2.8-sparc, but now I keep getting the error "While connecting to database, odbc returned the error: Access denied for user: '@localhost' to database 'umls2002ac'...
1
4088
by: Lyn Duong | last post by:
Hi, I have tried creating a linked server in microsoft sql 2000 to a db2 for vm database. I use a db2 v8 admin client, configure it via client configuration setup and then in Microsoft SQL Server 2000 enterprise manager, I create a linked server, I use ibm oledb driver for db2, datasource = mydatabase, product=my database, provider = db2oledb. When I try to access the database via an openquery to the linked server, I get an error from...
2
9433
by: arsisthesis | last post by:
Hi all, I have a curious problem with the ERROR 1044 and 1045: -system: OS X 10.4.3 (bash shell) -bash schell prompt: /~ kssun$ -I have set passwd to 'kssun' -I set path: PATH=${PATH}:/usr/local/mysql/bin - symptom 1
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
3270
by: igotyourdotnet | last post by:
Ok, here is the issue: I have 2 web pages one does a file upload to a database and the other page does a FTP to a server, both pages use the c:\temp directory. The page that uploads to a database works fine, the page that FTP's the files returns me an error (Access denied filename.txt) Now the asp.net ID has full control of the c:\temp directory. The only difference in the 2 pages is that page 2 creates a text file writes data to it then...
10
6960
by: happyse27 | last post by:
Hi All, I got this apache errors(see section A1 and A2 below) when I used a html(see section b below) to activate acctman.pl(see section c below). Section D below is part of the configuration of section c. Not sure where went wrong as the web page displayed internal server error. Also, what is the error 543? and error 2114. Where to find the list of errors in websites as it is not the standard apache error. I could not find...
0
8392
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8305
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8823
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8730
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7321
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
6163
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
4151
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
4301
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1950
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.