954,219 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

I am New In MySQL. Problem With MySQL Database Plz Help.

Hi All,
I am New in MySQL. I Want to Create a Database in MySQL. I am Using MySQL5.0 & Write This Sentex for Creating Database :- CREATE DATABASE db_name;
But When I Use This Sentex Create Database With Single db.opt File. & I run this Database on Server Message Desplaye "Database Not Found"
How Can I Do Create Database in MySQL to Run on My FTP Server. Plz Anyone Help Me.

hemgoyal_1990
Junior Poster
176 posts since Aug 2007
Reputation Points: 18
Solved Threads: 17
 

Your question is somewhat lacking in some crucial information that is needed to help you.

For example, what OS are you running this on?

Are you sure the MySQL server is running? How do you know?

Have you created a user besides 'root', and logged in as that user?

Can you connect to the MySQL from the command line?

Have you read the documentation at www.mysql.com ?

trudge
Junior Poster
178 posts since Sep 2007
Reputation Points: 18
Solved Threads: 20
 

For example, what OS are you running this on?
WIN XP SP2.

Are you sure the MySQL server is running? How do you know?
I Don't Know. How I Can Check This.

Have you created a user besides 'root', and logged in as that user?
I Have already Create user 'root'. And i Dont Know How Can I Logged.

Can you connect to the MySQL from the command line?
I Dont Know How Can I Connect to MySQL from Command Line.

Have you read the documentation at www.mysql.com ?[/QUOTE]
Yes. I am Read Document But dont Understand anything.

hemgoyal_1990
Junior Poster
176 posts since Aug 2007
Reputation Points: 18
Solved Threads: 17
 

For example, what OS are you running this on? WIN XP SP2.

Are you sure the MySQL server is running? How do you know? I Don't Know. How I Can Check This.

Have you created a user besides 'root', and logged in as that user? I Have already Create user 'root'. And i Dont Know How Can I Logged.

Can you connect to the MySQL from the command line? I Dont Know How Can I Connect to MySQL from Command Line.

Have you read the documentation at www.mysql.com ?


Yes. I am Read Document But dont Understand anything.[/QUOTE]

First you must understand there are 2 'parts' to MySQL - the server and the client.

The server is the part that does all the database work, and the client is how to send SQL commands to the server to get executed. MySQL ships with both.

When you installed MySQL you were given a choice to install the server as either a 'service' or a stand-alone application. Which did you choose?

As a service, the MySQL server runs in the background and is started each time the computer starts. As a stand-alone, it runs when you execute a command to start the server, and stops when you execute the command to stop the server. If it is installed as a 'service' you can check this from the Control Panel under 'Administrative Toos -> Services'. If you see 'MySQL' in the list, and the status is 'Started' then you have installed it as a service. Please post the results of this finding.

How did you create a user 'root'? How do you know there is a user called 'root'?

First you have to determine whether the server is running before doing anything else.

trudge
Junior Poster
178 posts since Sep 2007
Reputation Points: 18
Solved Threads: 20
 

Yes I am Found MySQL in Service under Adminstartion Tool & I Found it this Place. It's States are 'Started'. Plz Suggest me What Can I Do Next.

hemgoyal_1990
Junior Poster
176 posts since Aug 2007
Reputation Points: 18
Solved Threads: 17
 
Yes I am Found MySQL in Service under Adminstartion Tool & I Found it this Place. It's States are 'Started'. Plz Suggest me What Can I Do Next.

OK. Now you should create a user - it's not a good idea to use 'root' except when absolutely necessary.

When you are in a DOS shell window, you should be able to run the client and log in as 'root' with no password, unless you added a password during installation.

Change to the /bin directory of MySQL.

Enter: mysql --user root -h localhost

You should see a new prompt like this:
mysql>
This is the client prompt. You can now enter SQL commands, such as
mysql> show databases;

If this works then quit by entering 'exit'.

I don't know what version of MySQL you installed, but the mysql.com web site has documentation for creating a user. Then you must GRANT that user whatever rights you want them to have (create, select, delete, etc.).

Once you have a user (with password) created, then try this:

If MySQL is in your PATH you should be able to do something like this:
mysql --user=xxxxx --password=yyyyy -h localhost
and then you should see a new prompt like this:
mysql>

Again enter 'show databases;'

If this works, you have successfully created a user besides 'root', which is a good thing.
Enter 'exit' to quit the shell.

Now you can either use the existing client or install a different one like phpMyAdmin, or HeidiSQL. I suggest using the existing shell until you are very comfortable with the different SQL commands and what their results are.

To create databases use the mysqladmin command. But first you should get a user properly configured.

trudge
Junior Poster
178 posts since Sep 2007
Reputation Points: 18
Solved Threads: 20
 

it First i am Using MySQL 5.0 Downloading From http://dev.mysql.com and I am Install this on My System. This run On DOS Screen. and When I Start This is Ask For Password. When I Enter Password. It's Redirect to me On mysql> Command Line Pompt and after this i am using CREATE DATABASE db_name; syntex for Creating Database. But When I Using This Syntex I am Successfully Created Database but This not Work on My FTP Server. This Syntex Only One File Create db.opt.

What Can u meet me on Chating in Yahoo. I am Online on my e-Mail:- [email]hemgoyal_1990@yahoo.co.in[/email] . I am Online Everyday 3.00 to 4.30 PM.

Plz Send me Better Sugession so I can Develope my City Telephone Number Searching Project.

Thank You.

hemgoyal_1990
Junior Poster
176 posts since Aug 2007
Reputation Points: 18
Solved Threads: 17
 

it First i am Using MySQL 5.0 Downloading From http://dev.mysql.com and I am Install this on My System. This run On DOS Screen. and When I Start This is Ask For Password. When I Enter Password. It's Redirect to me On mysql> Command Line Pompt and after this i am using CREATE DATABASE db_name; syntex for Creating Database. But When I Using This Syntex I am Successfully Created Database but This not Work on My FTP Server. This Syntex Only One File Create db.opt.

What Can u meet me on Chating in Yahoo. I am Online on my e-Mail:- [email]hemgoyal_1990@yahoo.co.in[/email] . I am Online Everyday 3.00 to 4.30 PM.

Plz Send me Better Sugession so I can Develope my City Telephone Number Searching Project.

Thank You.

First I do not choose to use any form of Chat to help you solve your problem. Others may benefit from our thread so if you want my help keep your postings public.

Second, what do you plan to do with your database once it is created? Is it for personal use only, on your home computer, or will it be for public access via the web? This makes a lot of difference in how your questions are answered.

I don't know what your ftp server has to do with setting up MySQL.

trudge
Junior Poster
178 posts since Sep 2007
Reputation Points: 18
Solved Threads: 20
 

I am Using my Database for Public Access on Web. I am Developed a Site www.kuchamancity.com . this is my Home town Website. & I am Provide Search Facility in This Website. my FTP Server is Linux. So I want to Create database in MySQL. Plz Suggest me.

hemgoyal_1990
Junior Poster
176 posts since Aug 2007
Reputation Points: 18
Solved Threads: 17
 
I am Using my Database for Public Access on Web. I am Developed a Site www.kuchamancity.com . this is my Home town Website. & I am Provide Search Facility in This Website. my FTP Server is Linux. So I want to Create database in MySQL. Plz Suggest me.

Then you must find out from your host whether MySQL is installed, and whether you have access to it. Then using either phpMyAdmin or Heidi or some other client program, create your database and tables etc.

To find out more about MySQL go to mysql.com or find yourself a good book. You cannot learn enough about it from a few forum postings.

If you own your own server and are maintaining it for public access then you have quite a lot on your plate to learn.

So first answer whether your web domain is hosted by another company or by yourself.

Either way you will have to take some time and learn about relational databases in general and MySQL in particular on your own.

You will also need a programming language to access the web-based database such as Perl or PHP or Java or Python, etc.

Your ftp server has nothing to do with MySQL or this thread.

trudge
Junior Poster
178 posts since Sep 2007
Reputation Points: 18
Solved Threads: 20
 

Then you must find out from your host whether MySQL is installed, and whether you have access to it. Then using either phpMyAdmin or Heidi or some other client program, create your database and tables etc.

To find out more about MySQL go to mysql.com or find yourself a good book. You cannot learn enough about it from a few forum postings.

If you own your own server and are maintaining it for public access then you have quite a lot on your plate to learn.

So first answer whether your web domain is hosted by another company or by yourself.

Either way you will have to take some time and learn about relational databases in general and MySQL in particular on your own.

You will also need a programming language to access the web-based database such as Perl or PHP or Java or Python, etc.

Your ftp server has nothing to do with MySQL or this thread.


First ) My Web Domain is Hosted by www.techplanethosting.com . This is my Brother companey.

Second ) i am Using PHP for Accessing my Database But When i Create Datanase and Load it to my FTP server & Using PHP for Accessing Database PHP show Database not Found.

What Can i Do.

hemgoyal_1990
Junior Poster
176 posts since Aug 2007
Reputation Points: 18
Solved Threads: 17
 

First ) My Web Domain is Hosted by www.techplanethosting.com . This is my Brother companey.

Second ) i am Using PHP for Accessing my Database But When i Create Datanase and Load it to my FTP server & Using PHP for Accessing Database PHP show Database not Found.

What Can i Do.

Where are you creating your database? On your hosted web site or on your home computer?

Show me the PHP code you are using to create a database and access it.

Why do you keep talking about your ftp server? IT HAS NOTHING TO DO WITH THIS.

I believe you need to educate yourself a bit more on the concept of a web-based database. There seems to be some confusion in your mind on how things work. Do some research using your favourite search engine, or visit your library or school for some good material. I am not prepared to do this for you.

trudge
Junior Poster
178 posts since Sep 2007
Reputation Points: 18
Solved Threads: 20
 






NameTelephoneBirthday  

Search database:






ID
Name
Telephone
Birthday

<?php
if ($_POST['Go'])//user clicks go..
{
$hostname = "localhost"; // The Thinkhost DB server.
$username = "kuchcity"; // The username you created for this database.
$password = ""; // The password you created for the username.
$usertable = "details"; // The name of the table you made.
$dbName = "example"; // This is the name of the database you made.

MYSQL_CONNECT($hostname, $username, $password) OR DIE("DB connection unavailable");
@mysql_select_db( "$dbName") or die( "Unable to select database");
?>
<?php

//error message (not found message)begins
$XX = "No Record Found, to search again please try again";
//query details table begins

$query = mysql_query("SELECT * FROM details WHERE '$_POST[metode]' LIKE '$_POST[search]'% LIMIT 0, 50");
while ($row = @mysql_fetch_array($query))
{
$variable1=$row["id"];
$variable2=$row["name"];
$variable3=$row["telephone"];
$variable4=$row["birthday"];
//table layout for results

print ("");
print ("$variable1");
print ("$variable2");
print ("$variable3");
print ("$variable4");
print ("");
}
//below this is the function for no record!!
if (!$variable1)
{
print ("$XX");
}
//end
}
?>

hemgoyal_1990
Junior Poster
176 posts since Aug 2007
Reputation Points: 18
Solved Threads: 17
 

1) I am Created this Database on My Home PC. not on Web or FTP. I dont Know how to Create Database on Web directly.

2) I am Using Code For Searchin not Creating Database. Code is Showen Below :-

[snip]

$hostname = "localhost"; // The Thinkhost DB server. $username = "kuchcity"; // The username you created for this database. $password = ""; // The password you created for the username. $usertable = "details"; // The name of the table you made. $dbName = "example"; // This is the name of the database you made.

MYSQL_CONNECT($hostname, $username, $password) OR DIE("DB connection unavailable"); @mysql_select_db( "$dbName") or die( "Unable to select database");

//error message (not found message)begins $XX = "No Record Found, to search again please try again"; The Above Code is Show error Msg "Unable to Select Database."

You don't need to include your whole script when posting, just the relevant parts that illustrate where you are having a problem.

So we have established something:

1) you say this database is created on your home computer.
Please tell me how you created this database and the table 'details'.

2) if the database exists, show me how you access it from the command line using the parameters you are using with PHP (username, password, database name, and table). If you can't access it this way there is no point in trying to access it with PHP or any other technology.

3) since you are trying to use PHP to access your database, what web server have you installed that lets you do this? Even on your home computer, you must have a working web server installed before you can access a database this way.

Again, my suggestion to you is to do a LOT of research and learning on your own first. I've already suggested a few starting points (your school, library, the web, a good book).

trudge
Junior Poster
178 posts since Sep 2007
Reputation Points: 18
Solved Threads: 20
 

In thinking about your situation a question arose: why do think you need to use MySQL for your purpose? Do you know what a relational database is?

According to your posted code, you are only tracking 4 pieces of data: name, phone number and birthday (plus an added ID field, which I don't see the purpose of).

So what could be simpler than a plain text file formatted as CSV or whatever?

For example:
id1|my name|yyyymmdd|nnnnnnnnnn
id2|your name|yyyymmdd|nnnnnnnnnn
id3|his name|yyyymmdd|nnnnnnnnnn
id4|her name|yyyymmdd|nnnnnnnnnn

You can use PHP's native string / regex functions to find whatever you want.

Using a relational database for such a simple task is like using a sledge hammer to put in a 1" finishing nail.

trudge
Junior Poster
178 posts since Sep 2007
Reputation Points: 18
Solved Threads: 20
 

In thinking about your situation a question arose: why do think you need to use MySQL for your purpose? Do you know what a relational database is?

According to your posted code, you are only tracking 4 pieces of data: name, phone number and birthday (plus an added ID field, which I don't see the purpose of).

So what could be simpler than a plain text file formatted as CSV or whatever?

For example: id1|my name|yyyymmdd|nnnnnnnnnn id2|your name|yyyymmdd|nnnnnnnnnn id3|his name|yyyymmdd|nnnnnnnnnn id4|her name|yyyymmdd|nnnnnnnnnn

You can use PHP's native string / regex functions to find whatever you want.

Using a relational database for such a simple task is like using a sledge hammer to put in a 1" finishing nail.


Hi,
I am Using This Command for Creating Database "CREATE DATABASE example;"
and Table Creating Command "CREATE TABLE details;"
and I am Just Using MySQL 5.0 . and My Web Server is Linux.

hemgoyal_1990
Junior Poster
176 posts since Aug 2007
Reputation Points: 18
Solved Threads: 17
 
Hi, I am Using This Command for Creating Database "CREATE DATABASE example;" and Table Creating Command "CREATE TABLE details;" and I am Just Using MySQL 5.0 . and My Web Server is Linux.


'CREATE TABLE details'
That is not legal MySQL code.

trudge
Junior Poster
178 posts since Sep 2007
Reputation Points: 18
Solved Threads: 20
 
'CREATE TABLE details' That is not legal MySQL code.

CREATE TABLE details
(
id int(20),
name varchar(25),
telephone int(30),
birthday datetime
);

This is Full Sentex/Command.

hemgoyal_1990
Junior Poster
176 posts since Aug 2007
Reputation Points: 18
Solved Threads: 17
 

CREATE TABLE details ( id int(20), name varchar(25), telephone int(30), birthday datetime );

This is Full Sentex/Command.

OK. So you have created the table. How are you accessing this database? Command line? Some other program?

Have you populated it?

And Linux is not your web server. Linux is your Operating System.

Have you considered my earlier post regarding using a simple text file for your needs? I think the approach you are taking is quite a bit beyond your capability right now.

trudge
Junior Poster
178 posts since Sep 2007
Reputation Points: 18
Solved Threads: 20
 

OK. So you have created the table. How are you accessing this database? Command line? Some other program?

Have you populated it?

And Linux is not your web server. Linux is your Operating System.

Have you considered my earlier post regarding using a simple text file for your needs? I think the approach you are taking is quite a bit beyond your capability right now.

I am Accessing This Database on Command Line.

and My OS is Window XP SP2.

hemgoyal_1990
Junior Poster
176 posts since Aug 2007
Reputation Points: 18
Solved Threads: 17
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You