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 @@ <?xml version='1.0' encoding="UTF-8"?> -<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/metadoc.xml,v 1.101 2005/08/21 22:23:44 neysx Exp $ --> +<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/metadoc.xml,v 1.102 2005/08/25 05:19:14 fox2mike Exp $ --> <!DOCTYPE metadoc SYSTEM "/dtd/metadoc.dtd"> <metadoc lang="en"> -<version>1.31</version> +<version>1.32</version> <members> <lead>swift</lead> <lead>neysx</lead> @@ -82,6 +82,7 @@ <file id="partition-planning-tips">/doc/en/articles/partition-planning-tips.xml</file> <file id="maximum-swappage">/doc/en/articles/maximum-swappage.xml</file> <file id="bugzie-howto">/doc/en/bugzilla-howto.xml</file> + <file id="mysql-howto">/doc/en/mysql-howto.xml</file> <file id="utf-8">/doc/en/utf-8.xml</file> <file id="cron-guide">/doc/en/cron-guide.xml</file> <file id="ldap-howto">/doc/en/ldap-howto.xml</file> @@ -538,6 +539,10 @@ <memberof>other</memberof> <fileid>bugzie-howto</fileid> </doc> + <doc id="mysql-howto"> + <memberof>sysadmin_specific</memberof> + <fileid>mysql-howto</fileid> + </doc> <doc id="utf-8"> <memberof>sysadmin_general</memberof> <memberof>desktop_config</memberof> 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 =================================================================== <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE guide SYSTEM "/dtd/guide.dtd"> <!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/mysql-howto.xml,v 1.1 2005/08/25 05:19:14 fox2mike Exp $ --> <guide link="/doc/en/mysql-howto.xml"> <title>MySQL Startup Guide</title> <author title="Author"> <mail link="[EMAIL PROTECTED]">Chris White</mail> </author> <author title="Editor"> <mail link="[EMAIL PROTECTED]">Shyam Mani</mail> </author> <author title="Editor"> <mail link="[EMAIL PROTECTED]">Xavier Neys</mail> </author> <abstract> This document helps a user set up and use MySQL. </abstract> <!-- The content of this document is licensed under the CC-BY-SA license --> <!-- See http://creativecommons.org/licenses/by-sa/2.5 --> <license/> <version>1.0</version> <date>2005-08-25</date> <chapter> <title>Getting Started With MySQL</title> <section> <title>Background</title> <body> <p> 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. </p> </body> </section> <section> <title>MySQL Installation</title> <body> <p> 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. </p> <pre caption="Installing MySQL"> <comment>(View available USE flags)</comment> # <i>emerge --pretend --verbose mysql</i> <comment>(Install MySQL)</comment> # <i>emerge mysql</i> </pre> <p> Upon completion of the installation, you will see the following notice: </p> <pre caption="MySQL einfo message"> You might want to run: "ebuild /var/db/pkg/dev-db/mysql-[version]/mysql-[version].ebuild config" if this is a new install. </pre> <p> Since this is a new installation, we run the command. You need to press <c>ENTER</c> 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. </p> <pre caption="MySQL configuration"> # <i>ebuild /var/db/pkg/dev-db/mysql-[version]/mysql-[version].ebuild config</i> * 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: <comment>(Note the next 3 lines)</comment> /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. <comment>(Some MySQL non-ebuild specific information has been removed from here so as to keep this document as consistent as possible)</comment> * For security reasons you should set your MySQL root * password as soon as possible. </pre> <impo> As of mysql-4.0.24-r2, passwords are entered during the config phase making root password entry more secure. </impo> <p> The config script has already printed out the commands we need to run to setup our password, so we shall now run them. </p> <pre caption="Setting up your MySQL root password"> # <i>/etc/init.d/mysql start</i> * Re-caching dependency info (mtimes differ)... * Starting mysqld (/etc/mysql/my.cnf) ... [ ok ] <comment>(Replace new-password with your desired password)</comment> # <i>/usr/bin/mysqladmin -u root -h localhost password 'new-password'</i> </pre> <p> You can now test that your root password was successfully configured by trying to login to your MySQL server: </p> <pre caption="Logging into the MySQL server using mysql"> $ <i>mysql -u root -h localhost -p</i> 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> </pre> <p> The <c>-u</c> switch sets the user that will be logging in. The <c>-h</c> switch sets the host. This will usually be <c>localhost</c> unless you are setting up a remote server. Finally, <c>-p</c> tells the mysql client that you will be entering a password to access your database. Notice the <c>mysql></c> 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. </p> </body> </section> </chapter> <chapter> <title>Setting Up The Database</title> <section> <title>Creating A Database</title> <body> <p> 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 <c>SHOW DATABASES</c> command. </p> <pre caption="Displaying MySQL databases"> mysql> <i>SHOW DATABASES;</i> +----------+ | Database | +----------+ | mysql | | test | +----------+ 2 rows in set (0.09 sec) </pre> <impo> Please remember that MySQL commands should end with a semicolon -- <c>;</c> </impo> <p> Despite the fact that a test database is already created, we are going to create our own. Databases are created using the <c>CREATE DATABASE</c> command. We'll create one named "gentoo". </p> <pre caption="Creating the gentoo database"> mysql> <i>CREATE DATABASE gentoo;</i> Query OK, 1 row affected (0.08 sec) -- [email protected] mailing list
