Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > MySQL-How to Add Database?

MySQL-How to Add Database?
Thread Tools
MacOS
Junior Member
Join Date: Aug 2002
Location: Maltby, WA.
Status: Offline
Reply With Quote
Oct 11, 2002, 09:41 PM
 
I've download the Dreamweaver MX PHP/MySQL Record Store tutorial. Included is the database files. The tutorial is for Windows which has you drop the database into MySQL "data" folder.

I changed the permission on /etc/local/mysql/data so I could drop the database files into it then change the premission back. When I tried to view the web page I got an error about a bad password.

I'm thinking that I need to have MySQL read/import to create the databases. Correct?
     
Lucidwray
Junior Member
Join Date: Oct 2001
Location: Great State of Texas
Status: Offline
Reply With Quote
Oct 17, 2002, 04:55 AM
 
First of all,do you have MySQL running on a remote server or did you install it locally on your machine?

Second, you will mostlikley have to log into the MySQL server using the command line to create a new database. The database file that you are talking about it most likley a text file that has the database definitions in it.
Try This, open the database file in a text editor like bbedit. It should look something like this...

CREATE DATABASE COUNTER_DATABASE;

CREATE TABLE counter (
id int(10) NOT NULL auto_increment,
page varchar(25) NOT NULL default '',
date varchar(30) NOT NULL default '',
ip varchar(25) NOT NULL default '',
login_name varchar(25) NOT NULL default '0',
KEY id (id)
) TYPE=MyISAM;

it might be longer or shorter and everything will be named slightly different but you get the gist...

This is a SQL statement that you send to the server telling it to create a table "counter" in a database "COUNTER_DATABASE".

I know it sounds compled but its pretty straight forward.

Heres what you will need to do to use the text from your file to build the databsae you need. (assuming you are running MySQL localy on your machine.)

1) open a terminal window
2) type "mysql -u username -p" hit return, (replace username with whatever username you have for the database)
3) it will prompt you for a password, enter it and then hit return.
4) you should see something like this "mysql>"
5) open the file with your database info in it and copy everything thats in there.
6) paste it into the terminal window and hit return
7) if everything goes as planned you should see something like "mysql> 0 rows returned" or something to that effect (no errors basicaly)
8) your all done

if you need help setting up MySQL on OSX check out this site. Its awesome..
http://www.entropy.ch/software/macosx/mysql/

Also, be sure to check out www.mysql.com if you need any specific help with mysql. Their documentation area has a very nice searchable area that is usually very helpful.

Hope that helps even a little.
nolo contendere: A legal term meaning: "I didn't do it, judge, and I'll never do it again."
     
   
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 09:46 PM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,