From: "Shyam Mani" <fox2mike@lark.gentoo.org>
To: gentoo-doc-cvs@lists.gentoo.org
Subject: [gentoo-doc-cvs] cvs commit: mysql-howto.xml
Date: Wed, 24 Aug 2005 11:51:02 +0000 [thread overview]
Message-ID: <200508241150.j7OBoBsq010273@robin.gentoo.org> (raw)
fox2mike 05/08/24 11:51:02
Added: xml/htdocs/doc/en/draft mysql-howto.xml
Log:
Putting it here for a check-up + some URLification.
Revision Changes Path
1.1 xml/htdocs/doc/en/draft/mysql-howto.xml
file : http://www.gentoo.org/cgi-bin/viewcvs.cgi/xml/htdocs/doc/en/draft/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/draft/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 "http://www.gentoo.org/dtd/guide.dtd">
<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/draft/mysql-howto.xml,v 1.1 2005/08/24 11:51:02 fox2mike Exp $ -->
<guide link="/doc/en/mysql-howto.xml">
<title>MySQL Startup Guide</title>
<author title="Author">
<mail link="chriswhite@gentoo.org">Chris White</mail>
</author>
<author title="Editor">
<mail link="fox2mike@gentoo.org">Shyam Mani</mail>
</author>
<abstract>
This document helps a user setup 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-24</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, setup 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="Install MySQL">
<comment>(Viewing 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 have a mysql prompt 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)
</pre>
<p>
--
gentoo-doc-cvs@gentoo.org mailing list
next reply other threads:[~2005-08-24 11:51 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-08-24 11:51 Shyam Mani [this message]
-- strict thread matches above, loose matches on Subject: below --
2005-08-24 14:47 [gentoo-doc-cvs] cvs commit: mysql-howto.xml Xavier Neys
2005-08-24 17:07 Xavier Neys
2005-08-25 5:19 Shyam Mani
2005-08-25 5:21 Shyam Mani
2005-08-25 7:47 Shyam Mani
2005-08-26 19:51 Shyam Mani
2005-12-02 13:16 Xavier Neys
2005-12-15 15:39 Xavier Neys
2006-08-08 13:45 Xavier Neys
2006-09-13 14:19 Jan Kundrat
2008-05-19 20:35 Sven Vermeulen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200508241150.j7OBoBsq010273@robin.gentoo.org \
--to=fox2mike@lark.gentoo.org \
--cc=docs-team@lists.gentoo.org \
--cc=gentoo-doc-cvs@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox