Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Commands, how to use them

Status
Not open for further replies.

benbutleruk

Technical User
Apr 8, 2001
2
GB
Dear sir/madam,

I am new to MySQL and downloaded it last night. I now have it running on my Windows 2000 Server but have a rather large problem. This may sound stupid but everywhere in the manual etc there are commands for me to enter, eg I am learning from zdnet.com how to use MySQL and it has told be to use the following statemt to create a table:

CREATE TABLE TipsTable (tipID INT IDENTITY,
subDate DATETIME DEFAULT GETDATE(),
author VARCHAR(50), journal VARCHAR(3),
title VARCHAR(255), tip TEXT)

but the problem is I dont know where to type this statement. There are also other commands in the manual but I just dont know
where to enter them.

PLEASE HELP ME

Thanks,

Ben Butler UK :cool:
 
I've never used mysql on a non-Linux Platform but, on a Linux system, you start the interface by just typing "mysql" at the command line.

Perhaps there is a DOS utility that came with the mysql package? It might be part of the client package??

Alternately, if you can find a program that can manage SQL databases via ODBC, you could add an ODBC entry for mysql and use it that way.


Hope that helps a little
 
Yes, you just open up a DOS command prompt and type in "mysql", to get the mysql copmmand prompt, and then you enter all those commands you mention above.

You might have to specify or cd to the exact directory for the mysql.exe executable; for example "c:\mysql\bin\mysql.exe".
 
I just downloaded the same thing and I'm lost as well, The problem is that there is a GUI called WINmySQLadmin, and one called mySQLmanager.

"I'm very smart and very lost" I have no clue as how to get this to work, I know what the outcome needs to be, but I have no idea where to begin.

Can you help us.

 
OK here is any easy one,
When I'm at the shell# or Dos> prompt and I type

create table employee
(first varchar(15),
last varchar(20),
age number(3),
address varchar(30),
city varchar(20),
state varchar(20));

how do I end the statement(save the table) so I can move on to another table.

 
Well... to start with, your table creation query will not work. MySQL does not have a column type called 'number'. What you are looking for is probably tinyint(3).

This URL explains the column types:
Other than that, your syntax is OK, and if you just end your query with a semicolon, and hit enter, it should execute and save the table.

If you are doing this from the DOS prompt, that's your problem. As I state above, you need to enter the mysql command prompt first. Then you should be at something that looks like

mysql>

(a cool hint, by the way: if you hit the up or down arrows, you can scroll back and forth between previous commands, modify them and run them again.)

Your table has no primary key, index or id field. You might want to read a little more about SQL table creation. (Check out the links I gave you in the other post)

If you really want a GUI, why not try the one created by MySQL themselves: MySQLGUI? There's a link to it on the home page.
 
OK here is another question, I have a FreeBSD machine running all my WebPages and that is on the internet, I have a win95 machine running MySql, (I'm Experimenting) on my network at home (cable modem), how do I get the FreeBSD machine to communicate with my win95 machine.

For example, I want to post info from Php form the freeBSD machine to the MySQL DB on my Win95 machine. Also I'd like the Php on the FreeBSD machine to Query info from the MySQL DB and post to the web.

any help is great, I have a hard time finding tutorials on the web that have this type of info.
 
Try reading about the mysql functions on In the meantime, here is a standard php page I use as a template for my projects. Replace 'localhost' with the ip address of your MySQL machine.

Hope this helps,
-Rob

Code:
<HTML><HEAD></HEAD>
<BODY>
<FORM METHOD=&quot;post&quot; ACTION=&quot;index.php&quot;>
Search: <INPUT TYPE=&quot;text&quot; NAME=&quot;searchterm&quot;>
<?php
If (!$linkup = @mysql_connect (&quot;localhost&quot;, &quot;[URL unfurl="true"]wwwguest&quot;,[/URL] &quot;&quot;)) {
	echo &quot;<P><center><STRONG>Sorry, database is unavailable</STRONG></CENTER>&quot;;
} else {
	mysql_select_db(&quot;mydb&quot;,$linkup);

	// now we construct the main sql statement
	$sql = &quot;SELECT product_id,title, author, media, price, blurb, image_path &quot;;
	$sql .= &quot;FROM products WHERE (&quot;;

	if ($searchterm) {
		$sql .= &quot;(title Like \&quot;%$searchterm%\&quot;) OR (author Like \&quot;%$searchterm%\&quot;)&quot;;
	} else {
		$sql .= &quot;(title is null)&quot;;
	}
	$sql .= &quot;);&quot;;

	if ($result = @mysql_query(&quot;$sql&quot;)) {

		// now we build the page
		if (!$n = mysql_num_rows($result)) {
			echo &quot;Sorry, no matching records&quot;;
		} else {
			echo &quot;($n result(s) found):<BR>\n&quot;;
			echo &quot;<TABLE WIDTH=\&quot;100%\&quot; BORDER=1>\n&quot;;
			while ($row = mysql_fetch_array($result)) {
				echo &quot;<TR>&quot;;
				echo &quot;<TD>$row[product_id]</TD>&quot;;
				echo &quot;<TD>$row[title]</TD>&quot;;
				echo &quot;<TD>$row[author]</TD>&quot;;
				echo &quot;<TD>$row[media]</TD>&quot;;
				echo &quot;<TD>$row[price]</TD>&quot;;
				echo &quot;</TR>\n<TR>&quot;;
				echo &quot;<TD COLSPAN=3>$row[blurb]</TD>&quot;;
				echo &quot;<TD COLSPAN=2><IMG SRC=\&quot;$row[image_path]\&quot;></TD>&quot;;
				echo &quot;</TR>\n&quot;;
			}
			echo &quot;</TABLE>\n&quot;;
		}
	}
	mysql_close ($linkup);
}
?>
</FORM>
</BODY></HTML>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top