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.

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?

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.

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.

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.

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.

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:- hemgoyal_1990@yahoo.co.in . 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.

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:- hemgoyal_1990@yahoo.co.in . 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.

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.

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.

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.

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.

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.

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 :-

<HTML>
<BODY>
<FORM Action="/SearchInSide.php" Method="POST">
<div align="center">
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td bordercolor="#000000">
<p align="center">
<select name="metode" size="1">
<option value="name">Name</option>
<option value="telephone">Telephone</option>
<option value="birthday">Birthday</option>
</select> <input type="text" name="search" size="25"> &nbsp;<br>
Search database: <input type="submit" value="Go!!" name="Go"></p>
</td>
</tr>
</table>
</div>
</form>


<center>
<table border="1" cellpadding="5" cellspacing="0" bordercolor="#000000">
<tr>
<td width="60"><b>ID</b></td>
<td width="100"><b>Name</b></td>
<td width="70"><b>Telephone</b></td>
<td width="150"><b>Birthday</b></td>
</tr>

<?php
if ($_POST)//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 ("<tr>");
print ("<td>$variable1</td>");
print ("<td>$variable2</td>");
print ("<td>$variable3</td>");
print ("<td>$variable4</td>");
print ("</tr>");
}
//below this is the function for no record!!
if (!$variable1)
{
print ("$XX");
}
//end
}
?>
</table>
</center>
</BODY>
</HTML>

The Above Code is Show error Msg "Unable to Select Database."

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).

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.

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.

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.

'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.

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.

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.

I am Accessing This Database on Command Line.

and My OS is Window XP SP2.

Good, you can access it from the command line. What exactly is your problem / question then?

This is beginning to look like a PHP problem rather than a MySQL problem.

Good, you can access it from the command line. What exactly is your problem / question then?

This is beginning to look like a PHP problem rather than a MySQL problem.

my Problem is I cannot Access my Database on PHP createde with PHP.
What Can u Send me Complete Processure for Creating Database in MySQL.
First to Last Step so I Can Create Database in MySQL & Use it.

U Can Send me This Complete Producer in Text File Attach With This.

Plz Help me. U R So Greate.

my Problem is I cannot Access my Database on PHP createde with PHP.
What Can u Send me Complete Processure for Creating Database in MySQL.
First to Last Step so I Can Create Database in MySQL & Use it.

U Can Send me This Complete Producer in Text File Attach With This.

Plz Help me. U R So Greate.

You have already said you have created this database and the table from the command line, now you are asking how to create it with PHP.

I have already said that to solve your immediate problem you might be better to use a simple text file to hold your data. There is no need to use MySQL.

Why do you think you need MySQL?

Why do you think you need PHP?

Please answer ALL questions I ask you, not just the ones you want to.

You seem to be lacking some very fundamental knowledge of several areas of Internet technology.

Have you heard the expression 'Walk before you run'? This applies to you.

You need to educate yourself on some very basic concepts before you go fooling around with some code you found somewhere.

I will not be sending you any 'Complete Producer' as you have already indicated you have the database created.

Show me the result of 'show databases' and 'show tables' and 'describe details' from your command line using the mysql client program that comes with MySQL. This is easy to capture and paste into your reply.

Again, your end task of providing a phone number database might be better served using simple text files. At your level of knowledge and experience that is all I am prepared to load on your plate.

You have already said you have created this database and the table from the command line, now you are asking how to create it with PHP.

I have already said that to solve your immediate problem you might be better to use a simple text file to hold your data. There is no need to use MySQL.

Why do you think you need MySQL?

Why do you think you need PHP?

Please answer ALL questions I ask you, not just the ones you want to.

You seem to be lacking some very fundamental knowledge of several areas of Internet technology.

Have you heard the expression 'Walk before you run'? This applies to you.

You need to educate yourself on some very basic concepts before you go fooling around with some code you found somewhere.

I will not be sending you any 'Complete Producer' as you have already indicated you have the database created.

Show me the result of 'show databases' and 'show tables' and 'describe details' from your command line using the mysql client program that comes with MySQL. This is easy to capture and paste into your reply.

Again, your end task of providing a phone number database might be better served using simple text files. At your level of knowledge and experience that is all I am prepared to load on your plate.

Q.1 ) I Need MySQL Creating Database, Tables only.

Q.2 ) and PHP Accessing it on Interne; I am Using PHP for Searching Database on Internet & Developing a Small my City Project. I Know PHP Someting.

& Plz Send me Text file for Creating Database. I am Just Waiting for Your Replay.

Q.1 ) I Need MySQL Creating Database, Tables only.

Q.2 ) and PHP Accessing it on Interne; I am Using PHP for Searching Database on Internet & Developing a Small my City Project. I Know PHP Someting.

& Plz Send me Text file for Creating Database. I am Just Waiting for Your Replay.

I don't program in PHP. You would be better asking these questions in a PHP forum.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.