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 :
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
Post a Comment