Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8917955
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T05:37:50+00:00 2026-06-15T05:37:50+00:00

I just learnt how to connect to a DB. However I intentionally put the

  • 0

I just learnt how to connect to a DB. However I intentionally put the wrong user to return an error. But it doesn’t, it keeps showing me that I am connected.

<?php


$mysql_host = 'localhost';
$mysql_user = 'root';
$mysql_pass = '';

@mysql_connect($mysql_host,$mysql_user,$mysql_pass) or die('Sorry');

echo 'Connected';
?>

In this case it shows connected because there is a user named root in my DB, but if I replace with anything else, it still shows Connected and not Sorry.

I am not allowed to answer my own question because of less reputation apparently and I was asked to wait for some 8 hours or edit my question and fix it. (I hope you guys give me some ticks so that I can answer too 😛 Just kidding)

So here is the fix:

When I went to users overview tab under localhost link, it showed “User: Any”, “Host: localhost”, “Privileges: Usage”. I just deleted that thing. And kept the pma, linux and root thing alone. Removed that extra user (don’t know how it came) and that fixed the problem.

So basically for any user, it was connecting and giving access.

I don’t know if I am allowed to answer my own question but since I figured it out I am posting it so that it helps someone when they are in need and are on a similar boat.

Sorry and thanks to everyone 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T05:37:52+00:00Added an answer on June 15, 2026 at 5:37 am

    Firstly as other said, you should used mysql library anymore

    But as far your question goes:

    mysql_connect($mysql_host,$mysql_user,$mysql_pass) or die('Error'.mysql_error());
    

    Also, “or die” statement shouldn’t be use really in anything it kills the script and uslaly you want to “die” gracefully

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just learnt Cocos2d, but i am not an expert on it. But
I wanted to learn twitter connect example. For that i just downloaded a sample
I just learnt about generators in Python a week back. From what I understood,
I just learnt about how to parse data in Xcode using NSXMLPARSER. In order
I just learnt XSLT today when I wanted to pretty print the playlist export
I've just learnt how to use the Struts 2 file uploader to upload a
I have just learnt about temporary tables and using them has given me some
Okay, just learnt LINQ syntax about ten minutes ago, made a first program: public
I am new to Java Persistence API . I have just learnt it and
I just have learnt how cool RSpec and Cabybara is, and now working around

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.