Jump to content

local mysql problem


Recommended Posts

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?

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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;

 

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.