|
|||||
|
|
#1 |
|
|
If I want to set up my first database and start using it in Dreamweaver what do I need to do? The book I'm working on has a CD with the database on. It is telling me to put it in the MySql folder on drive C. However, when I'm in Dreamweaver I c**** on Applications at the side, and the plus button to add a MySql database. It tells me to enter the following info: Connection Name: conn_newland MySQL Server: localhost Usename: root P***word: leave p***word blank Database: newland_tours If I enter all this info and c**** to test it comes up with error 1049 unknown database. This makes me wonder whether I have put the database in the correct folder? When I c**** on the select button next to Database within these settings it only lists two databases: test and mysql. The newland_tours.sql database that I put into the MySql folder on drive C is not listed. Am I doing something wrong do you know and should this be in another folder? Gracias John Win XP Pro / DW 7.0.1 Running locally: Apache 2.0.49 / PHP 4.3.7 / MySQL 4.0.20a |
|
|
#2 |
|
|
John wrote: >If I want to set up my first database and start using it in >Dreamweaver what do I need to do? first thing you need to do is to understand that dreamweaver has nothing whatsoever to do with databases. >The book I'm working on has a CD with the database on. It is telling >me to put it in the MySql folder on drive C. do you understand why it is telling you to do this? if i wrote a book, supposedly about PHP programming, and told you that the first thing you need to do is to open the Start menu, then c**** on Run, then type 'cmd' , then type 'format c:' and answer 'yes' to the prompt, would you do it because it said so in the book? i'm not saying your book is wrong, it's just that from your line of questioning i think that maybe you need to undestand a little bit more about what you are trying to do before you actually do it. >However, when I'm in Dreamweaver I c**** on Applications at the side, >and the plus button to add a MySql database. It tells me to enter the >following info: > >Connection Name: conn_newland >MySQL Server: localhost >Usename: root >P***word: leave p***word blank >Database: newland_tours > >If I enter all this info and c**** to test it comes up with error 1049 >unknown database. > >This makes me wonder whether I have put the >database in the correct folder? i'm presuming that you're using Window$: the default location for mysql databases on Window$ is X:\[path-to-mysql]\data so, if installed mysql to, for example, c:\program files\mysql, then your data files will be in c:\program files\mysql\data 1. find out where your mysql installation lives (eg. :\program files\mysql) 2. look in the 'data' sub-directory (eg. :\program files\mysql\data) - you should see sub-directories called 'mysql' and 'test' - these are the databases you can see via. dreamweaver. 3. copy your cd's data files here re-start mysql (may not be necessary, not sure, won't hut to do it anyway) |
|
|
#3 |
|
|
> I notice that there are two folders within the mysql\data folder names > test and mysql. I have put the newland_tours.sql file in this > mysql\data folder as well. Hi John, This is probably not the best way to create your files - .sql files are usually an SQL script, not a database file and I'm ***uming this is true. Like Herbie says, you should understand what you are doing, rather than following instructions blindly. I would urge you to have a look at the manual. The .sql script may well create the database for you, but as I don't have it in front of me, I can only guess that it doesn't. Ideally start at the beginning, or you could jump to the relevant pages here: http://dev.mysql.com/doc/mysql/en/Cr..._database.html will tell you how to create your database http://dev.mysql.com/doc/mysql/en/Batch_mode.html will tell you how to run the script > When I go back into Dreamweaver I have no experience of Dreamweaver, so I can't answer this part for you. Regards, Andy |
|
|
#4 |
|
|
On Sun, 20 Jun 2004 11:29:45 -0700, bonehead <sendmenospam@here.net>
wrote: >Okay I have a couple of points to add to this this thread that might >actually be useful. > >John wrote: >>>>When I'm in Dreamweaver I c**** on Applications at the side, >>>>and the plus button to add a MySql database. It tells me to enter the >>>>following info: >>>> >>>>Connection Name: conn_newland >>>>MySQL Server: localhost >>>>Usename: root >>>>P***word: leave p***word blank >>>>Database: newland_tours >>>> >>>>If I enter all this info and c**** to test it comes up with error 1049 >>>>unknown database. > >The 'Database' argument in the above is telling Dreamweaver to select, >for this Dreamweaver 'Site', a particular database called newland_tours. > This would be the equivalent of the mysql_select_db('newland_tours') >statement in php. > >The reason you are getting the 1049 unknown db error is that the >database has not been *created* yet. BTW you obviously haven't set a >p***word for the mysql root user account, or you would have received an >'unable to connect' error. > >> I notice that there are two folders within the mysql\data folder names >> test and mysql. I have put the newland_tours.sql file in this >> mysql\data folder as well. > >'test' is a database. 'mysql' is the the database that contains all the >user accounts and permissions for mysql. Don't **** with this unless you >really know what you are doing. > >A .sql file is not a database. You cannot create and populate a database >by simply putting this file in that directory. In fact, you should *not* >be putting this file in that directory because that directory really >should contain *only* actual databases. Instead, you should put this >file in some other do***ent directory, log on to the mysql client on >your local machine (the one running mysql), and *execute* the file. > >A .sql file typically contains a set of SQL statements to do such things >as create a database, create the tables and relationships within the >database, and load the tables with data. Open this 'newland_tours.sql' >file in a text editor such as EditPlus or TextPad (both free, BTW, and >EditPlus is highly preferable because it also lets you ftp), and you >should see statements like these: > >CREATE IF NOT EXISTS DATABASE newland_tours; >CREATE IF NOT EXISTS TABLE myTableName1; >CREATE IF NOT EXISTS TABLE myTableName2; >etc. etc. etc. Yes there's stuff like that in the file. >To actually *do* all of these things, you need to *execute* the .sql file. > >I do not know exactly how to do this in M$, but on the UNIX side, it >would look like this: > >1. Log on to a terminal session (command prompt). >2. Invoke the mysql client (in this case, asking for a p***word prompt): > >%mysql -p >3. On getting the p***word prompt, enter the p***word: > >%P***word: 'myp***wordhere' >4. When successfully logged on, you get the mysql prompt: > >mysql >5. The >mysql prompt on the above line shows that I have logged on to >the mysql client successfully. On your machine, you would probably just >bring up a command prompt and invoke the mysql client as the root user, >and since you haven't set a p***word for the root user, you don't need a >p***word prompt, thus: I can get to the mysql client as root user without a p***word. A username and p***word is listed in the my.ini file however. >C:\Do***ents and Settings\bonehead>mysql -u root >C:>mysql > >To execute the .sql file, I use the 'source' command. For example, if >the .sql file is located on my UNIX desktop, the command would be > > >mysql source /home/bonehead/Desktop/newland_tours.sql; > >When I hit Enter, the file executes in the mysql default directory. I'm with you so far but when I hit enter I get a lot of error messages. At the mysql prompt I am typing: source c:\mysql\newland_tours.sql The first two error messages I get say: Error 1044: Access denied for user: '@localhost' to database 'newland_tours' followed by about 30 or so saying: Error 1046 No database selected. John |
|
|
#5 |
|
|
On 20 Jun 2004 11:58:09 -0700, abarfield_01@yahoo.com (Andy Barfield)
wrote: >John <phpMySQL.newbie@needshelp.com> wrote in message news:<ka9bd0lecbpsf2jackljdrhgt5o0pvst8t@4ax.com>. .. > >> I notice that there are two folders within the mysql\data folder names >> test and mysql. I have put the newland_tours.sql file in this >> mysql\data folder as well. > >Hi John, >This is probably not the best way to create your files - .sql files >are usually an SQL script, not a database file and I'm ***uming this >is true. Like Herbie says, you should understand what you are doing, >rather than following instructions blindly. I would urge you to have >a look at the manual. > >The .sql script may well create the database for you, but as I don't >have it in front of me, I can only guess that it doesn't. > >Ideally start at the beginning, or you could jump to the relevant >pages here: >http://dev.mysql.com/doc/mysql/en/Cr..._database.html will tell >you how to create your database > >http://dev.mysql.com/doc/mysql/en/Batch_mode.html will tell you how to >run the script > > >> When I go back into Dreamweaver > >I have no experience of Dreamweaver, so I can't answer this part for >you. > >Regards, > >Andy I think the problem is that I get access denied so it must be some sort of user problem? I have been to the dev.mysql.com site before and it didn't really help me. I think it is geared more towards advanced users and it's not easy to find what you need. I will take a look again though. John |
|
|
#6 |
|
|
I noticed that Message-ID: <f2ubd0tcuks0p9r8vo9jruqnel786qhlsl@4ax.com>
from John contained the following: >I think the problem is that I get access denied so it must be some >sort of user problem? I have been to the dev.mysql.com site before >and it didn't really help me. I think it is geared more towards >advanced users and it's not easy to find what you need. I will take a >look again though. I've found that the easiest way round this is to use the firepages www.firepages.com.au install of php, apache, mysql etc etc You get phpmyadmin which allows you to paste the contents of an .sql file into a text box. Hit the go button and the tables are created. It really is dead easy. But I'd also go along with what Margaret says. Dreamweaver is a great tool but I only got databases to work by going back to basics. Do some basic PHP and then as many tutorials as you can. If you have some PHP enabled webspace, use that for testing until you get more confident. It worked for me. -- Geoff Berrow (put thecat out to email) It's only Usenet, no one dies. My opinions, not the committee's, mine. Simple RFDs http://www.ckdog.co.uk/rfdmaker/ |
|
|
#7 |
|
|
John wrote:
> I'm with you so far but when I hit enter I get a lot of error > messages. > > At the mysql prompt I am typing: > > source c:\mysql\newland_tours.sql > > The first two error messages I get say: > > Error 1044: Access denied for user: '@localhost' to database > 'newland_tours' > > followed by about 30 or so saying: > > Error 1046 No database selected. Okay there's a couple of ways to troubleshoot this. On the face of it, it sounds like you need to make modifications to the permissions for the mysql root user. In any event, another, actually easier approach, if you just want to get the damn thing done so you can move on, (and you might just want to do this anyway, so you can see each line execute) is to open the .sql file in a text editor, then bring up a command prompt, log on to the mysql client as before, go back to the .sql file and copy and paste ONE *COMPLETE* command AT A TIME into the command window and hit Enter just to see each individual command execute. Each complete command is terminated with a semicolon. In fact, if you don't have much background in MySQL you probably should just do it that way anyhow so you can see how it works. If the first statement (CREATE IF NOT EXISTS DATABASE...) doesn't execute and throws an error, that's an indication that the permissions for the root account in mysql need to be modified. That's beyond the scope of what I can explain to you on the usenet, and you'll need to get a book. See the first and last of the four ISBNs I recommended previously for good examples of how to do this. |
|
|
#8 |
|
|
'bonehead wrote:
> If the first statement (CREATE IF NOT EXISTS DATABASE...) doesn't > execute and throws an error, that's an indication that the permissions > for the root account in mysql need to be modified. That's beyond the > scope of what I can explain to you on the usenet, and you'll need to get > a book. See the first and last of the four ISBNs I recommended > previously for good examples of how to do this. And BTW, the other posters in this thread are right: eventually you need to stop relying on Dreamweaver because you'll come to use it as a crutch, which you nearly are doing already. Don't get me wrong, I really like DW, it's the quickest, easiest tool for WYSIWYG web page design, hands down, and I've found it to be really helpful when I need to slap stuff together real fast. But one of the great things about php is that you can turn it on and off within the same script, so you can go back and forth between html and php. Plus it's much easier to write debug blocks so you can make sure your database code is executing correctly. Plus a whole bunch of other advantages that I really don't have time to go into here. I recently finished the first version of a web database survey system. Without going into a lot of detail, the system includes three generic subforms, two of which contain 240 fields (!!!) don't ask me why, that's what the users wanted so I just did it. Anyway, the fields on the subforms had to be organized into specific groups, and the *only* thing I used DW for was to design the layout of those subforms so the users could see what they would look like. When I knew that I finally finally finally had it the way the users wanted it, I just pasted the php variables into the html, and then copied and pasted the whole thing into the appropriate sections of my php script and wrapped them in heredoc tags. Once you've done it that way, you'll never go back. Good luck and keep bangin away, you'll get it... |