+ 1
why am i getting this error
Uncaught Error: Call to undefined function mysql_connect() in /home1/upscalf7/public_html/user_log/connection.php:7 Stack trace: #0 /home1/upscalf7/public_html/user_log/log_exec.php(6): require_once() #1 {main} thrown in /home1/upscalf7/public_html/user_log/connection.php on line 7 also this Access denied for user 'root'@'localhost' <?php $host = "localhost"; $dbuser = "root"; $dbpass = ""; $db = "upscalf7_aec"; $prefix = ""; $conn =mysql_connect("$host","$dbuser","$dbpass","$db") or die("Could not connect database"); $link =new mysql_select_db($conn, $db) or die("Could not select database"); ?>
11 Antworten
+ 2
It's fine. What happens when you try to authenticate to mysql from a command prompt:
Assuming Windows and that mysql is in the path (Linux / others just start a terminal):
start | run | cmd.exe
mysql -u root -p (press enter)
If your password is truly blank, press enter at the password prompt. If it is not blank and it's not accepting your password, you can still reset the password (but you need host privileges). For this I'll need to send you to the database parts of StackExchange.
If command prompt / terminal isn't working for you, you can download MySQL Workbench from the mysql official site (just skip the registration requirement), which gives you a nice GUI.
+ 1
Does phpinfo() show that the mysql module is loaded? (it's perplexing that you're getting both 'undefined' and 'access denied')
+ 1
Run this code and search the output for mysql and what module seems to be associated:
<?php
phpinfo();
?>
Also, what PHP version?
+ 1
mysql_connect has been removed in PHP 7. Two alternatives at this link:
https://stackoverflow.com/questions/34088373/call-to-undefined-function-mysql-connect-after-upgrade-to-php-7
Essentially:
mysqli_connect() ... or ...
PDO::__construct()
+ 1
i changed it to mysqli do you know why it wont take root as the username anymore forgive me i am so new at this
+ 1
cool great again thanks
0
how do i find out that info about phpinfo()
0
i got the first one due to the fact that i did not have mysqli only mysql and then i got the second error
0
php version 7.0.31
mysql version 5.6.32-78.1
0
it use to take “root” did something change
0
changing it to the pdo thanks