sheridan Posted June 25, 2007 Share Posted June 25, 2007 i have written a php script that was going to be used for user authentication. it won't work locally, but it will work on the webserver i have access to. i think it's never connecting to my database locally. here is the code: <?php $user = "root"; $password = "sheridan."; $database = "test"; mysql_connect(localhost, $user, $password); //@mysql_create_db($database) or die ("could not create database"); @mysql_select_db($database) or die ("Error: ID10T"); $query = "CREATE TABLE users ( id int(11) auto_increment, username varchar(20), password varchar(20), email varchar(30), fname varchar(20), lname varchar(20), PRIMARY KEY(id), UNIQUE(id), KEY id_2(id) )"; mysql_query($query); mysql_close(); ?> any suggestions? something on my computer locally is possibly preventing the connection? or perhaps it has to do with my configuration of the database or something of that nature? Quote Link to comment https://forums.phpfreaks.com/topic/57021-local-mysql-problem/ Share on other sites More sharing options...
AndyB Posted June 25, 2007 Share Posted June 25, 2007 $user = "root"; $password = "sheridan."; $database = "test"; $host = "localhost"; mysql_connect($host, $user, $password); Quote Link to comment https://forums.phpfreaks.com/topic/57021-local-mysql-problem/#findComment-281712 Share on other sites More sharing options...
sheridan Posted June 25, 2007 Author Share Posted June 25, 2007 that makes no difference Quote Link to comment https://forums.phpfreaks.com/topic/57021-local-mysql-problem/#findComment-282003 Share on other sites More sharing options...
sheridan Posted June 25, 2007 Author Share Posted June 25, 2007 i uninstalled everything and then installed it all back via XAMPP...phpMyAdmin isn't working with XAMPP because it says it can't load the php mysql extension. but it's enabled in the php.ini and i've pasted the php_mysql.dll in lots of places...just won't pick it up. i'm assuming this was my problem before that it wasn't loading the mysql extension for the functions i was trying to do? Quote Link to comment https://forums.phpfreaks.com/topic/57021-local-mysql-problem/#findComment-282145 Share on other sites More sharing options...
the_oliver Posted June 25, 2007 Share Posted June 25, 2007 Im assuming that you tried changing $host = "localhost"; to your servers IP address? It could be that your DB service is not liking connections as root. Quote Link to comment https://forums.phpfreaks.com/topic/57021-local-mysql-problem/#findComment-282156 Share on other sites More sharing options...
sheridan Posted June 25, 2007 Author Share Posted June 25, 2007 i have mysql configured to allow root login. i have a friend who had same setup as me as far as i know..i told him how to install...and it worked for him. Quote Link to comment https://forums.phpfreaks.com/topic/57021-local-mysql-problem/#findComment-282250 Share on other sites More sharing options...
TreeNode Posted June 25, 2007 Share Posted June 25, 2007 If you need to connect to a database remotely, try this: Grant all privileges on *.* to USERNAME@IP identified by "PASSWORD"; USERNAME is the username that you would like to create. IP is the public IP address of your remote connection. PASSWORD is the password you would like to use for this username. You now must flush MySQL's privileges. Run this command: FLUSH PRIVILEGES; Quote Link to comment https://forums.phpfreaks.com/topic/57021-local-mysql-problem/#findComment-282258 Share on other sites More sharing options...
sheridan Posted June 25, 2007 Author Share Posted June 25, 2007 i'm trying to do this: have a local mysql and apache server configured with php where i can develop locally. i don't want anyone else able to connect or whatever, just a little development lab for myself. i've tried installing everything individually, i generally left the configs alone, just changed the root directory for apache. this apparently worked for my friend who also did it, but not moi. after that i uninstalled everything and just ran XAMPP, that didn't work out either. but i've looked at the configs and they don't have a problem with root logins and such. Quote Link to comment https://forums.phpfreaks.com/topic/57021-local-mysql-problem/#findComment-282268 Share on other sites More sharing options...
TreeNode Posted June 25, 2007 Share Posted June 25, 2007 windows or linux? Quote Link to comment https://forums.phpfreaks.com/topic/57021-local-mysql-problem/#findComment-282270 Share on other sites More sharing options...
sheridan Posted June 25, 2007 Author Share Posted June 25, 2007 windows Quote Link to comment https://forums.phpfreaks.com/topic/57021-local-mysql-problem/#findComment-282285 Share on other sites More sharing options...
sheridan Posted June 25, 2007 Author Share Posted June 25, 2007 i just went into the other room and installed WAMP5 on my desktop computer, everything worked perfectly. i came back in here, uninstalled XAMPP, installed WAMP5 on this computer. same problems. what is the difference? Quote Link to comment https://forums.phpfreaks.com/topic/57021-local-mysql-problem/#findComment-282437 Share on other sites More sharing options...
TreeNode Posted June 26, 2007 Share Posted June 26, 2007 Perhaps it has something to do with your Windows settings. You're not signed in as an admin or you have a firewall up (turn off windows firewall). Also, make sure the permissions of the XAMPP files are r/w for you. You might also want to try to grant remote access to mysql like I mentioned before hand, just give the same IP as your computer. http://textbook.textpattern.net/wiki/index.php?title=Using_XAMPP_(Apache-MySQL-PHP-Perl)_for_Windows Quote Link to comment https://forums.phpfreaks.com/topic/57021-local-mysql-problem/#findComment-282941 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.