Problem Setting-Up MySQL Per LXF151 Modern Perl

The place to post if you need help or advice

Moderators: ChrisThornett, LXF moderators

Problem Setting-Up MySQL Per LXF151 Modern Perl

Postby gdawg » Wed Mar 21, 2012 12:32 am

Hi - After jumping thru hoops getting and installing MySQL I'm having a problem creating the 'books' database. This is where I'm stalled:
Code: Select all
mysql> create user 'books'@'localhost' identified by 'README';
ERROR 1396 (HY000): Operation CREATE USER failed for 'books'@'localhost'
The magazine article shows this as the second entry and the LXFDVD shows it at end. I've tried it both ways with same result. I've never used MySQL before so I'm unsure of how to correct this error. All help is appreciated.
Linux gdawg-Satellite-C675 2.6.38-8-generic-pae #42-Ubuntu SMP Mon Apr 11 05:17:09 UTC 2011 i686 i686 i386 GNU/Linux
gdawg
 
Posts: 13
Joined: Fri Nov 18, 2011 2:55 pm
Location: New Mexico, USA

Postby johnhudson » Sun Mar 25, 2012 3:02 pm

A bit of terminological inexactitude here:

To create anything, you normally need to be 'root'

To create a database called books, you enter:
CREATE DATABASE books;

I would not then normally create a user called 'books' - 'guest' or 'reader' would be better if you want lots of people to access the database.

Though I cannot see anything wrong with the syntax of your CREATE USER statement, it may be worth checking that you were logged in as root and, if so, the contents of mysql.user (that is, the user table in the mysql database).

However, for adding users I prefer

USE mysql
INSERT INTO user (Host,User,Password) VALUES ('host','user',PASSWORD('password'));
FLUSH PRIVILEGES;

which hashes the password immediately.

Note that both leave your password exposed in the mysql_history file; so open an editor and delete these lines in your mysql-history file.

mysql is supplied as default with no passwords and two anonymous users anyway. It is possible the version you have installed comes with a different configuration of mysql.user.

Finally, the mysql documentation - open a console and enter 'info mysql' - is excellent and well worth reading with care if you are new to it - though, because it is so big, you may find difficulty wading through it all for the nuggets you need. There are plenty of easy introductions too.
johnhudson
LXF regular
 
Posts: 871
Joined: Wed Aug 03, 2005 1:37 pm

Postby lok1950 » Sun Mar 25, 2012 4:30 pm

though, because it is so big, you may find difficulty wading through it all for the nuggets you need. There are plenty of easy introductions too.


And if you use KDE you don't have wade though it in a terminal :wink: call up the KDE info center.

Enjoy the Choice :)
User avatar
lok1950
LXF regular
 
Posts: 1031
Joined: Tue May 31, 2005 5:31 am
Location: Ottawa

Postby gdawg » Mon Mar 26, 2012 12:28 am

Thank you both for your replies. I can see I need to do some studying of MySQL instead of just following directions in magazine. I appreciate your help.

Following the Modern Perl tutorial in LXF 151, authored by Dave Cross, I have been able to progress past the MySQL section and am now attempting to implement the Perl section.
Under the 'Find the author' paragraph there is a requirement to 'get the ISBN of a book from Amazon' using this entry in the console: ./book add 0330258648
./book list
I get this result when I enter the 1st command:
Code: Select all
gdawg-Satellite-C675 jane # ./book add 0330258648
Can't locate Net/Amazon.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.10.1 /usr/local/share/perl/5.10.1 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.10 /usr/share/perl/5.10 /usr/local/lib/site_perl .) at ./book line 7.
BEGIN failed--compilation aborted at ./book line 7
Any help with this will be very much appreciated.
Linux gdawg-Satellite-C675 2.6.38-8-generic-pae #42-Ubuntu SMP Mon Apr 11 05:17:09 UTC 2011 i686 i686 i386 GNU/Linux
gdawg
 
Posts: 13
Joined: Fri Nov 18, 2011 2:55 pm
Location: New Mexico, USA


Return to Help!

Who is online

Users browsing this forum: Exabot [Bot] and 1 guest