473,387 Members | 1,529 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,387 software developers and data experts.

Help regarding connection

I was trying to create a website that enables the users to Input something in it, like user info. but it always gives an error whenever I try to test submit the inputted data's into the database.
'Could not Connect: Access denied for user 'smdg'@'localhost' (using password: YES)'

connection:

Expand|Select|Wrap|Line Numbers
  1. define('DB_NAME', 'testdb');
  2. define('DB_USER', 'smdg');
  3. define('DB_PASSWORD','samplepass');
  4. define('DB_HOST', 'localhost');
  5.  
  6. $link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD, '3306');
config.inc.php

Expand|Select|Wrap|Line Numbers
  1. /* Authentication type and info */
  2. $cfg['Servers'][$i]['auth_type'] = 'cookie';
  3. $cfg['Servers'][$i]['user'] = 'smdg';
  4. $cfg['Servers'][$i]['password'] = '';
  5. $cfg['Servers'][$i]['extension'] = 'mysqli';
  6. $cfg['Servers'][$i]['AllowNoPassword'] = true;
  7. $cfg['Lang'] = '';
  8.  
  9. /* Bind to the localhost ipv4 address and tcp */
  10. $cfg['Servers'][$i]['host'] = '127.0.0.1';
  11. $cfg['Servers'][$i]['connect_type'] = 'tcp';
anyone who can point out what I did wrong or what I'm missing?
Sep 9 '15 #1
4 1841
RonB
589 Expert Mod 512MB
Are you able to connect from the command line using the same credentials?

Take the port number out of the connect statement.

Don't use the mysql_ functions, they are depreciated. Instead, you should be using mysqli_ or PDO.
Sep 9 '15 #2
yes I am able to connect, I double checked it.

take note that my problem is i cant insert any info to the database by connecting through the internet. I can view the Form in which the Infos will be inputted but when I try to press 'submit' button it always gives me an error saying 'Access denied for user "user@localhost" blah blah. like that, I've consulted some friends and they said that it should work but it doesn't
Sep 10 '15 #3
RonB
589 Expert Mod 512MB
Which of those 2 code snippets are you using when connecting to the database?

The first one is using the mysql_connect() function incorrectly and should generate a syntax error. The second one doesn't show the connect statement but implies that it will be using the mysqli_connect() function.

There is also a discrepancy with the configured password. Since you're receiving an access denied error instead of a syntax error, I'll assume you're using the second code snippet when connecting, which is passing an empty string as the password instead of the password configured in the other snippet. Have you tried setting the password?

Try changing:
Expand|Select|Wrap|Line Numbers
  1. $cfg['Servers'][$i]['password'] = '';
To:
Expand|Select|Wrap|Line Numbers
  1. $cfg['Servers'][$i]['password'] = 'samplepass';
Make sure you put in the real password.
Sep 10 '15 #4
still the same. no improvement, maybe ill just try a different approach on this. thanks for your help though. cheers
Sep 15 '15 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Ratnakar Pedagani | last post by:
Hi, I'm new to c# programming. I need help regarding a form which contains a help in the main menu. upon clicking the sub items of help menu, i should be able to display a pop up displaying the...
2
by: sachin | last post by:
Hello Everybody I need some help regarding Natural Language Processing. I am designing a MT system from a SOV language to a SOV language. I need a parser which can find the root word...
7
by: Mrinal Kamboj | last post by:
Hi , I am using OracleConnection object from Oracle ODP.net provider and following is the behaviour which i am finding bit strange : To start with my argument is based on followings facts : ...
2
by: xyzbindu | last post by:
hello, iam a student & need help regarding UPDATE method of dataadapter when i update the database using dataadpter.update(dataset,tablename) i get the following error an unhandled exception of...
1
by: chandrapsg | last post by:
Hi, i am working with jsp .. i wanna help regarding how to import or how to call python modules to jsp if a piece of code is availabe will be very helpful for me chandra
5
by: dannynnad | last post by:
Hi, SuperAdministrator when trying to edit the frontend content the following error is comingup: "You are not authorized to view this resource." I checked from the backend whether the...
4
by: bsonline | last post by:
I hv a datetime format like '24/01/2008 15:56:01' . Now I have to select dates from a date range, but input datetime format like 24/1/2008 15:56:01'. I hv written the query like : "select...
0
by: ambassador | last post by:
good day guys, please help: i'm having trouble of displaying my data from ms access database to JList. if there's someone could help me, i would greatly appreciate it. i'm using netbeans 6.0...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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,...

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.