php - How am i able to connect to mysql without entering any username or password? -


i new php. learning in ubuntu operating system.

i tried connecting mysql, made mistake forgot enter username , password still able connect. how ??

my code :

<?php      mysql_connect('localhost','','') or die('could not connect database');      echo "connected database";      ?> 

output :

screen shot of output

before starts flaming using mysql_connect, suggest check manual functions. ( here can find infos function http://php.net/manual/en/function.mysql-connect.php , see it's deprecated. use @ least mysqli.).

another great resource http://www.phptherightway.com/#mysql_extension

the answer above correct (you're passing empty string) looking in manual, you'll see without passing should able connect ("default value defined mysql.default_user" if sql_safe_mode off, in php.ini).

i imagine fault not yours using mysql_connect, of old tutorial still around!

keep , cheers!


Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -