Overclock.net banner
1 - 18 of 18 Posts

·
Registered
Joined
·
127 Posts
Discussion Starter · #1 ·
I'm new to mySQL and after searching in internet how to make a database finally i found how. I made a database by:

mysql> CREATE DATABASE databasename;

after i gave the privileges to the user

mysql> GRANT ALL PRIVILEGES ON *>* TO 'user'@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION;

after i did:

mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES ON database1.* TO 'user'@'localhost' IDENTIFIED BY 'password'

after i downloaded a free template just to see if the database works. i edited this:

$host = "localhost";
$user = "user";
$pwd = "pass";
$db = "test1";

and when i restarted apache to configure the settings and went to the internet and typed my ip it came Query Failed!

What's the problem? How can i solve it?

Any help is appriciated.

EDIT: btw forgot to tell you that i'm using Ubuntu as my OS
 

·
Registered
Joined
·
1,923 Posts
whats the exact template minus the details?
 

·
Registered
Joined
·
240 Posts
It would help to know what template and what error exactly you are getting.

EDIT:
usually you need to add tables to a database with columns before you can just connect a website to it.
 

·
Registered
Joined
·
127 Posts
Discussion Starter · #5 ·
Quote:


Originally Posted by kyotejones
View Post

It would help to know what template and what error exactly you are getting.

EDIT:
usually you need to add tables to a database with columns before you can just connect a website to it.

i think that the problem is that i didn't made tables and columns :S Only the database any 1 can tell my how can i do that?
 

·
Registered
Joined
·
364 Posts
was there a file included with the template with the extension .sql ?

can you post the entire php script?
 

·
Registered
Joined
·
1,022 Posts
dude...use phpmyadmin to administer your db. It simplifies MySQL db administration compared to using the SQL console.
 

·
Registered
Joined
·
364 Posts
if the template is asking for a database connection, it probably also contains the table/column structure (probably from an sql dump)

he can use phpmyadmin to run the sql script (if there is one) then to later administer the data. but i doubt he can just create any random table structure... it doesn't look like that is his case.
 

·
Registered
Joined
·
1,470 Posts
Quote:

Originally Posted by h3llkill3r View Post
$host = "localhost";
Check to see if you need a port number to connect -- localhost:xxxx (and that you can access that port through a firewall).
 

·
Registered
Joined
·
1,470 Posts
Quote:


Originally Posted by theRemix
View Post

what?

if it's localhost, what firewall do you speak of?

On your computer (hope your computer has one!).

Too often you have to access the database via a port (so true with phpadmin --- usually 3306). If your database is being accessed remotely, you'll then use an IP and port number.

BTW, one of the best ways to learn about MySQL is to install some forum software. There you can learn even better ways to connect to a database, and more securely (and to avoid some problems like SQL injections).
 

·
Registered
Joined
·
364 Posts
Quote:


Originally Posted by StarryNite
View Post

On your computer (hope your computer has one!).

Too often you have to access the database via a port (so true with phpadmin --- usually 3306). If your database is being accessed remotely, you'll then use an IP and port number.

BTW, one of the best ways to learn about MySQL is to install some forum software. There you can learn even better ways to connect to a database, and more securely (and to avoid some problems like SQL injections).

by default, the mysql port is 3306, you do not set host to "localhost:3306" that won't work anyway.

and if you are on localhost that means the apache server (with php) is requesting a mysql server on the same machine.... what firewall blocks itself from itself?

maybe i misunderstood you.
 

·
Registered
Joined
·
1,470 Posts
It's been awhile since I've been forum designing, but sure enough had to set a port (and on servers with it's own dedicated database server - IP+port). When factoring in IDS ware, more so (many times the MySQL port isn't 3306 in that setup, it's 3316 or something). Port changing is a common security measure.
 

·
Registered
Joined
·
364 Posts
yes, you can connect to localhost:3316 or whatever port, my bad.

but still, can you really block localhost (yourself) from a particular port, or all ports, in a firewall ?
 

·
Registered
Joined
·
1,470 Posts
Yep. Configure the IDS ware to do so (this is *nix or *bsd) -- it'll block a-n-y-t-h-i-n-g! Temp directory (common way to harden it from racing); to even the SSH port (and a wonderful way to learn how to lock yourself out!).
 
1 - 18 of 18 Posts
This is an older thread, you may not receive a response, and could be reviving an old thread. Please consider creating a new thread.
Top