![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
|
Database | +--------------------+ information_schema | mac | mysql | performance_schema | test | +--------------------+ |
#2
| |||
| |||
|
|
Hello again. When I run this connect.php get and error. The php file contains: ?php $dblink = mysql_connect("localhost","root","")or die("Kunne ikke koble til database server"); $select_db = mysql_select_db("mac")or die("Kunne ikke velde database"); if(($dblink = true)and($select_db = true)){ echo "Du er koblet til og har valg database. Alt OK"; } ? But I get this error: Warning: mysql_connect() [function.mysql-connect]: [2002] No such file or directory (trying to connect via unix:///var/mysql/mysql.sock) in /Users/karl/Sites/connect.php on line 2 Warning: mysql_connect() [function.mysql-connect]: No such file or directory in /Users/karl/Sites/connect.php on line 2 Kunne ikke koble til database server From terminal I get this result: -------------------------------- Karl-Arne-Gjersyens-MacBook-Pro:Sites karl$ sudo /usr/local/mysql/bin/mysql Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1 Server version: 5.5.6-rc MySQL Community Server (GPL) Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. This software comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to modify and redistribute it under the GPL v2 license Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> SHOW DATABASES; +--------------------+ | Database | +--------------------+ | information_schema | | mac | | mysql | | performance_schema | | test | +--------------------+ 5 rows in set (0.03 sec) mysql What is wrong here? |
#3
| |||
| |||
|
|
Hello again. When I run this connect.php get and error. The php file contains: ?php $dblink = mysql_connect("localhost","root","")or die("Kunne ikke koble til database server"); $select_db = mysql_select_db("mac")or die("Kunne ikke velde database"); if(($dblink = true)and($select_db = true)){ echo "Du er koblet til og har valg database. Alt OK"; } ? |
#4
| |||
| |||
|
|
if(($dblink = true)and($select_db = true)){ What is wrong here? |
![]() |
| Thread Tools | |
| Display Modes | |
| |