Hi there, I''m totally new to ruby and rails, I am currently going through PP Agile Web Dev w/Rails and really enjoying it. I''ve always backed off learning more than basic Java, it always seemed so...heavy. (I''m an Interaction Designer/UI guy by trade as well). Anyway, so far rails is great. My question: In the book they show running mySQL command line commands within the rails directory - for example depot> mysql depot_development <db/create.sql When I try and do this, it errors out with "''mysql'' is not recognized as an internal or external command, operable program or batch file." Yet, I certainly have mySQL installed and running. I simply went to the mySQL command line tool and created my dbs/table there. However, I''d like to do it within rails to be able to update the tables like the book does - it''s a great idea using the flat file. How do I "hook up" the two and how come it isn''t by default? Ruby and mySQL are on the same drive...is there a step I missed? TIA Tom http://www.pixelmech.com/ A man spoke frantically into the phone: "My wife is pregnant and her contractions are only two minutes apart"! "Is this her first child?" the doctor asked. "No, you idiot!" the man shouted. "This is her husband!" Q: What do you call a muddy chicken who crossed the road two times? A: A dirty double crosser...
On 10/12/05, Tom Dell''Aringa <pixelmech-/E1597aS9LQAvxtiuMwx3w@public.gmane.org> wrote:> depot> mysql depot_development <db/create.sql > > When I try and do this, it errors out with > > "''mysql'' is not recognized as an internal or external command, operable > program or batch file."You need to make sure that the MySql bin directory is on your path. If you installed using the Windows installer then there is a checkbox which will add this for you otherwise append this directory to your path and you should be good to go. Josh _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Tom Dell''Aringa
2005-Oct-13 11:11 UTC
Re: Using the mySQL command line within rails problem
--- Josh Knowles <joshknowles-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> You need to make sure that the MySql bin directory is on your path. If you > installed using the Windows installer then there is a checkbox which will > add this for you otherwise append this directory to your path and you should > be good to go.I did install with the win installer, and I thought I checked that box but maybe not. In any event, can you explain to a n00b how one would go about appending this directory to my path...I''m not sure what path you are even talking about... Thanks Tom http://www.pixelmech.com/ A man spoke frantically into the phone: "My wife is pregnant and her contractions are only two minutes apart"! "Is this her first child?" the doctor asked. "No, you idiot!" the man shouted. "This is her husband!" Q: What do you call a muddy chicken who crossed the road two times? A: A dirty double crosser...
Tom Dell''Aringa wrote:> --- Josh Knowles <joshknowles-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > >>You need to make sure that the MySql bin directory is on your path. If you >>installed using the Windows installer then there is a checkbox which will >>add this for you otherwise append this directory to your path and you should >>be good to go. > > > I did install with the win installer, and I thought I checked that box but maybe not. In any > event, can you explain to a n00b how one would go about appending this directory to my path...I''m > not sure what path you are even talking about...On Windows 2000 it''s on the Advanced tab of the System control panel, under Environment Variables. Select ''Path'' from the System variables pane, and add ";C:\mysql\bin" (without the inverted commas - assuming that''s where you installed MySQL) to the end of the string in the ''Variable Value'' box. Click OK, OK, OK. Now, when you run the command interpreter, you should be able to type ''echo %PATH%'' and see the MySQL directory listed as part of the path. The mysql command should now work. -- Alex
Tom Dell''Aringa
2005-Oct-13 11:40 UTC
Re: mySQL command line within rails - access denied?
--- Alex Young <alex-qV/boFbD8Meu8LGVeLuP/g@public.gmane.org> wrote:> add ";C:\mysql\bin" (without the inverted commas - assuming > that''s where you installed MySQL) to the end of the string...Ah, that worked. One other problem then - I navigate to my app and run the sql command: C:\work\depot>mysql depot_development <db/create.sql ERROR 1045: Access denied for user ''ODBC''@''localhost'' (using password: NO) Any idea why this might be? My create.sql file is indeed in /db and I do have my .yml file configured. I am on windows 2003 server. Tom http://www.pixelmech.com/ A man spoke frantically into the phone: "My wife is pregnant and her contractions are only two minutes apart"! "Is this her first child?" the doctor asked. "No, you idiot!" the man shouted. "This is her husband!" Q: What do you call a muddy chicken who crossed the road two times? A: A dirty double crosser...
You need to create a user with proper rights (or use admin...). A good practice is to create a new user for every database, and set proper access for that user to that database. This way you prevent any stupid error. For dev I usually do the following: connect as root: mysql -uroot -p create the new database: create database blah; add a user: grant all on blah.* to ''blah'' identified by ''pwdblah''; set information in your blah application in config/database.yml: development: adapter: mysql database: blah host: localhost username: blah password: pwdblah Now you can also do mysql blah < db/create.sql Jos Tom Dell''Aringa wrote:>--- Alex Young <alex-qV/boFbD8Meu8LGVeLuP/g@public.gmane.org> wrote: > > >>add ";C:\mysql\bin" (without the inverted commas - assuming >>that''s where you installed MySQL) to the end of the string... >> >> > >Ah, that worked. One other problem then - I navigate to my app and run the sql command: > >C:\work\depot>mysql depot_development <db/create.sql >ERROR 1045: Access denied for user ''ODBC''@''localhost'' (using password: NO) > >Any idea why this might be? My create.sql file is indeed in /db and I do have my .yml file >configured. I am on windows 2003 server. > >Tom > > >http://www.pixelmech.com/ > >A man spoke frantically into the phone: "My wife is pregnant and her contractions are only two minutes apart"! "Is this her first child?" the doctor asked. "No, you idiot!" the man shouted. "This is her husband!" > >Q: What do you call a muddy chicken who crossed the road two times? >A: A dirty double crosser... > >_______________________________________________ >Rails mailing list >Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >http://lists.rubyonrails.org/mailman/listinfo/rails > >