From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lists.gentoo.org ([140.105.134.102] helo=robin.gentoo.org) by nuthatch.gentoo.org with esmtp (Exim 4.43) id 1E8A9Q-0003yn-4l for garchives@archives.gentoo.org; Thu, 25 Aug 2005 05:19:46 +0000 Received: from robin.gentoo.org (localhost [127.0.0.1]) by robin.gentoo.org (8.13.4/8.13.4) with SMTP id j7P5IDlF018380; Thu, 25 Aug 2005 05:18:13 GMT Received: from smtp.gentoo.org (smtp.gentoo.org [134.68.220.30]) by robin.gentoo.org (8.13.4/8.13.4) with ESMTP id j7P5IBer019181 for ; Thu, 25 Aug 2005 05:18:11 GMT Message-Id: <200508250518.j7P5IBer019181@robin.gentoo.org> Received: from lark.gentoo.osuosl.org ([140.211.166.177] helo=lark.gentoo.org) by smtp.gentoo.org with smtp (Exim 4.43) id 1E8A92-0004us-IJ for gentoo-doc-cvs@lists.gentoo.org; Thu, 25 Aug 2005 05:19:20 +0000 Received: by lark.gentoo.org (sSMTP sendmail emulation); Thu, 25 Aug 2005 05:19:14 +0000 From: "Shyam Mani" Date: Thu, 25 Aug 2005 05:19:14 +0000 To: gentoo-doc-cvs@lists.gentoo.org Subject: [gentoo-doc-cvs] cvs commit: mysql-howto.xml Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-doc-cvs@gentoo.org Reply-to: docs-team@lists.gentoo.org X-Archives-Salt: b18a67a5-be08-49a6-8b2e-9837a6f0e88f X-Archives-Hash: 2b835deda0537f6f8cdf3f02a45aa754 fox2mike 05/08/25 05:19:14 Modified: xml/htdocs/doc/en metadoc.xml Added: xml/htdocs/doc/en mysql-howto.xml Log: #98704 - New MySQL Guide by none other than our beloved PUNK, Chris White. Initial Version. Revision Changes Path 1.102 +7 -2 xml/htdocs/doc/en/metadoc.xml file : http://www.gentoo.org/cgi-bin/viewcvs.cgi/xml/htdocs/doc/en/metadoc.xml?rev=1.102&content-type=text/x-cvsweb-markup&cvsroot=gentoo plain: http://www.gentoo.org/cgi-bin/viewcvs.cgi/xml/htdocs/doc/en/metadoc.xml?rev=1.102&content-type=text/plain&cvsroot=gentoo diff : http://www.gentoo.org/cgi-bin/viewcvs.cgi/xml/htdocs/doc/en/metadoc.xml.diff?r1=1.101&r2=1.102&cvsroot=gentoo Index: metadoc.xml =================================================================== RCS file: /var/cvsroot/gentoo/xml/htdocs/doc/en/metadoc.xml,v retrieving revision 1.101 retrieving revision 1.102 diff -u -r1.101 -r1.102 --- metadoc.xml 21 Aug 2005 22:23:44 -0000 1.101 +++ metadoc.xml 25 Aug 2005 05:19:14 -0000 1.102 @@ -1,9 +1,9 @@ - + -1.31 +1.32 swift neysx @@ -82,6 +82,7 @@ /doc/en/articles/partition-planning-tips.xml /doc/en/articles/maximum-swappage.xml /doc/en/bugzilla-howto.xml + /doc/en/mysql-howto.xml /doc/en/utf-8.xml /doc/en/cron-guide.xml /doc/en/ldap-howto.xml @@ -538,6 +539,10 @@ other bugzie-howto + + sysadmin_specific + mysql-howto + sysadmin_general desktop_config 1.1 xml/htdocs/doc/en/mysql-howto.xml file : http://www.gentoo.org/cgi-bin/viewcvs.cgi/xml/htdocs/doc/en/mysql-howto.xml?rev=1.1&content-type=text/x-cvsweb-markup&cvsroot=gentoo plain: http://www.gentoo.org/cgi-bin/viewcvs.cgi/xml/htdocs/doc/en/mysql-howto.xml?rev=1.1&content-type=text/plain&cvsroot=gentoo Index: mysql-howto.xml =================================================================== MySQL Startup Guide Chris White Shyam Mani Xavier Neys This document helps a user set up and use MySQL. 1.0 2005-08-25 Getting Started With MySQL
Background

MySQL is a popular database server that is used in various applications. SQL stands for (S)tandard (Q)uery (L)anguage, which is what MySQL uses to communicate with other programs. On top of that, MySQL has its own expanded SQL functions to provide additional functionality to users. In this document, we'll look at how to do the initial MySQL installation, set up databases and tables, and create new users. Let's start out with the installation.

MySQL Installation

First make sure you have MySQL installed on your system. In case you need specific functionality from MySQL, please make sure you have the required USE flags enabled as they will help fine tune your installation.

(View available USE flags)
# emerge --pretend --verbose mysql
(Install MySQL)
# emerge mysql

Upon completion of the installation, you will see the following notice:

You might want to run:
"ebuild /var/db/pkg/dev-db/mysql-[version]/mysql-[version].ebuild config"
if this is a new install.

Since this is a new installation, we run the command. You need to press ENTER when prompted while configuring the MySQL database. The configuration sets up the main MySQL database which contains administrative information such as databases, tables, users, permissions and more. The configuration recommends that you change your root password as soon as possible. We will definitely do this, otherwise someone could come along by chance and hack our default setup MySQL server.

# ebuild /var/db/pkg/dev-db/mysql-[version]/mysql-[version].ebuild config
 * MySQL DATADIR is /var/lib/mysql
 * Press ENTER to create the mysql database and set proper
 * permissions on it, or Control-C to abort now...

   Preparing db table
   Preparing host table
   Preparing user table
   Preparing func table
   Preparing tables_priv table
   Preparing columns_priv table
   Installing all prepared tables

   To start mysqld at boot time you have to copy support-files/mysql.server
   to the right place for your system

   PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
   To do so, issue the following commands to start the server
   and change the applicable passwords:
(Note the next 3 lines)
   /etc/init.d/mysql start
   /usr/bin/mysqladmin -u root -h pegasos password 'new-password'
   /usr/bin/mysqladmin -u root password 'new-password'
   Depending on your configuration, a -p option may be needed
   in the last command. See the manual for more details.

(Some MySQL non-ebuild specific information has been removed from here
so as to keep this document as consistent as possible)

   * For security reasons you should set your MySQL root
   * password as soon as possible.
As of mysql-4.0.24-r2, passwords are entered during the config phase making root password entry more secure.

The config script has already printed out the commands we need to run to setup our password, so we shall now run them.

# /etc/init.d/mysql start
 * Re-caching dependency info (mtimes differ)...
 * Starting mysqld (/etc/mysql/my.cnf) ...        [ ok ]
(Replace new-password with your desired password)
# /usr/bin/mysqladmin -u root -h localhost password 'new-password'

You can now test that your root password was successfully configured by trying to login to your MySQL server:

$ mysql -u root -h localhost -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4 to server version: 4.0.24-debug

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql>

The -u switch sets the user that will be logging in. The -h switch sets the host. This will usually be localhost unless you are setting up a remote server. Finally, -p tells the mysql client that you will be entering a password to access your database. Notice the mysql> prompt. This is where you type in all your commands. Now that we're in the mysql prompt as the root user, we can begin to setup our database.

Setting Up The Database
Creating A Database

We have logged in and a mysql prompt is displayed. First let's take a look at the databases we currently have. To do so, we use the SHOW DATABASES command.

mysql> SHOW DATABASES;
+----------+
| Database |
+----------+
| mysql    |
| test     |
+----------+
2 rows in set (0.09 sec)
Please remember that MySQL commands should end with a semicolon -- ;

Despite the fact that a test database is already created, we are going to create our own. Databases are created using the CREATE DATABASE command. We'll create one named "gentoo".

mysql> CREATE DATABASE gentoo;
Query OK, 1 row affected (0.08 sec)



-- 
gentoo-doc-cvs@gentoo.org mailing list