Skip to Content
Developing Web Applications with Perl, memcached, MySQL® and Apache
book

Developing Web Applications with Perl, memcached, MySQL® and Apache

by Patrick Galbraith
July 2009
Intermediate to advanced
887 pages
21h 8m
English
Wrox
Content preview from Developing Web Applications with Perl, memcached, MySQL® and Apache

Appendix B. Configuring MySQL

Now that you have a running MySQL installation, as an administrator, you can make some configuration setting changes and perform some administrative tasks. The first thing to do is set up a schema and privileges to allow web applications to access that schema. Other tasks are to set various MySQL command options for optimal performance.

Running MySQL for the First Time

The first thing to do is to change the password for the root user. The root user is the default administrative user for the database. Even though the name is the same as the operating system root user, this root user is only a MySQL user, and any changes you make to this user are only made within the database. By default, this user has no password, though you can only connect to the database from the same host that the database is running on. Despite this, it is still a good idea to change it so the root user has an actual password. To change the root user's password, start the MySQL command line client:

mysql -user=root

Then set the user password with the following SQL statements:

mysql> SET PASSWORD FOR root@localhost=PASSWORD('rootpass');
mysql> SET PASSWORD FOR root@127.0.0.1=PASSWORD('rootpass');
mysql> SET PASSWORD FOR root@myhost=PASSWORD('rootpass');

Of course, replace the word rootpass in the previous code with the desired password. The reason for running this three times for the same user but different hosts is because database users are specified with user@host; in order for the ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Expert PHP and MySQL®

Expert PHP and MySQL®

Andrew Curioso, Ronald Bradford, Patrick Galbraith
PHP 7: Real World Application Development

PHP 7: Real World Application Development

Doug Bierer, Altaf Hussain, Branko Ajzele
Perl by Example

Perl by Example

Ellie Quigley
Mastering PHP 7

Mastering PHP 7

Branko Ajzele

Publisher Resources

ISBN: 9780470414644Purchase book