1 |
fox2mike 05/08/25 05:19:14 |
2 |
|
3 |
Modified: xml/htdocs/doc/en metadoc.xml |
4 |
Added: xml/htdocs/doc/en mysql-howto.xml |
5 |
Log: |
6 |
#98704 - New MySQL Guide by none other than our beloved PUNK, Chris White. Initial Version. |
7 |
|
8 |
Revision Changes Path |
9 |
1.102 +7 -2 xml/htdocs/doc/en/metadoc.xml |
10 |
|
11 |
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 |
12 |
plain: http://www.gentoo.org/cgi-bin/viewcvs.cgi/xml/htdocs/doc/en/metadoc.xml?rev=1.102&content-type=text/plain&cvsroot=gentoo |
13 |
diff : http://www.gentoo.org/cgi-bin/viewcvs.cgi/xml/htdocs/doc/en/metadoc.xml.diff?r1=1.101&r2=1.102&cvsroot=gentoo |
14 |
|
15 |
Index: metadoc.xml |
16 |
=================================================================== |
17 |
RCS file: /var/cvsroot/gentoo/xml/htdocs/doc/en/metadoc.xml,v |
18 |
retrieving revision 1.101 |
19 |
retrieving revision 1.102 |
20 |
diff -u -r1.101 -r1.102 |
21 |
--- metadoc.xml 21 Aug 2005 22:23:44 -0000 1.101 |
22 |
+++ metadoc.xml 25 Aug 2005 05:19:14 -0000 1.102 |
23 |
@@ -1,9 +1,9 @@ |
24 |
<?xml version='1.0' encoding="UTF-8"?> |
25 |
-<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/metadoc.xml,v 1.101 2005/08/21 22:23:44 neysx Exp $ --> |
26 |
+<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/metadoc.xml,v 1.102 2005/08/25 05:19:14 fox2mike Exp $ --> |
27 |
<!DOCTYPE metadoc SYSTEM "/dtd/metadoc.dtd"> |
28 |
|
29 |
<metadoc lang="en"> |
30 |
-<version>1.31</version> |
31 |
+<version>1.32</version> |
32 |
<members> |
33 |
<lead>swift</lead> |
34 |
<lead>neysx</lead> |
35 |
@@ -82,6 +82,7 @@ |
36 |
<file id="partition-planning-tips">/doc/en/articles/partition-planning-tips.xml</file> |
37 |
<file id="maximum-swappage">/doc/en/articles/maximum-swappage.xml</file> |
38 |
<file id="bugzie-howto">/doc/en/bugzilla-howto.xml</file> |
39 |
+ <file id="mysql-howto">/doc/en/mysql-howto.xml</file> |
40 |
<file id="utf-8">/doc/en/utf-8.xml</file> |
41 |
<file id="cron-guide">/doc/en/cron-guide.xml</file> |
42 |
<file id="ldap-howto">/doc/en/ldap-howto.xml</file> |
43 |
@@ -538,6 +539,10 @@ |
44 |
<memberof>other</memberof> |
45 |
<fileid>bugzie-howto</fileid> |
46 |
</doc> |
47 |
+ <doc id="mysql-howto"> |
48 |
+ <memberof>sysadmin_specific</memberof> |
49 |
+ <fileid>mysql-howto</fileid> |
50 |
+ </doc> |
51 |
<doc id="utf-8"> |
52 |
<memberof>sysadmin_general</memberof> |
53 |
<memberof>desktop_config</memberof> |
54 |
|
55 |
|
56 |
|
57 |
1.1 xml/htdocs/doc/en/mysql-howto.xml |
58 |
|
59 |
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 |
60 |
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 |
61 |
|
62 |
Index: mysql-howto.xml |
63 |
=================================================================== |
64 |
<?xml version="1.0" encoding="UTF-8"?> |
65 |
<!DOCTYPE guide SYSTEM "/dtd/guide.dtd"> |
66 |
<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/mysql-howto.xml,v 1.1 2005/08/25 05:19:14 fox2mike Exp $ --> |
67 |
|
68 |
<guide link="/doc/en/mysql-howto.xml"> |
69 |
<title>MySQL Startup Guide</title> |
70 |
|
71 |
<author title="Author"> |
72 |
<mail link="chriswhite@g.o">Chris White</mail> |
73 |
</author> |
74 |
<author title="Editor"> |
75 |
<mail link="fox2mike@g.o">Shyam Mani</mail> |
76 |
</author> |
77 |
<author title="Editor"> |
78 |
<mail link="neysx@g.o">Xavier Neys</mail> |
79 |
</author> |
80 |
|
81 |
<abstract> |
82 |
This document helps a user set up and use MySQL. |
83 |
</abstract> |
84 |
|
85 |
<!-- The content of this document is licensed under the CC-BY-SA license --> |
86 |
<!-- See http://creativecommons.org/licenses/by-sa/2.5 --> |
87 |
<license/> |
88 |
|
89 |
<version>1.0</version> |
90 |
<date>2005-08-25</date> |
91 |
|
92 |
<chapter> |
93 |
<title>Getting Started With MySQL</title> |
94 |
<section> |
95 |
<title>Background</title> |
96 |
<body> |
97 |
|
98 |
<p> |
99 |
MySQL is a popular database server that is used in various applications. SQL |
100 |
stands for (S)tandard (Q)uery (L)anguage, which is what MySQL uses to |
101 |
communicate with other programs. On top of that, MySQL has its own expanded SQL |
102 |
functions to provide additional functionality to users. In this document, we'll |
103 |
look at how to do the initial MySQL installation, set up databases and tables, |
104 |
and create new users. Let's start out with the installation. |
105 |
</p> |
106 |
|
107 |
</body> |
108 |
</section> |
109 |
<section> |
110 |
<title>MySQL Installation</title> |
111 |
<body> |
112 |
|
113 |
<p> |
114 |
First make sure you have MySQL installed on your system. In case you need |
115 |
specific functionality from MySQL, please make sure you have the required USE |
116 |
flags enabled as they will help fine tune your installation. |
117 |
</p> |
118 |
|
119 |
<pre caption="Installing MySQL"> |
120 |
<comment>(View available USE flags)</comment> |
121 |
# <i>emerge --pretend --verbose mysql</i> |
122 |
<comment>(Install MySQL)</comment> |
123 |
# <i>emerge mysql</i> |
124 |
</pre> |
125 |
|
126 |
<p> |
127 |
Upon completion of the installation, you will see the following notice: |
128 |
</p> |
129 |
|
130 |
<pre caption="MySQL einfo message"> |
131 |
You might want to run: |
132 |
"ebuild /var/db/pkg/dev-db/mysql-[version]/mysql-[version].ebuild config" |
133 |
if this is a new install. |
134 |
</pre> |
135 |
|
136 |
<p> |
137 |
Since this is a new installation, we run the command. You need to press |
138 |
<c>ENTER</c> when prompted while configuring the MySQL database. The |
139 |
configuration sets up the main MySQL database which contains administrative |
140 |
information such as databases, tables, users, permissions and more. The |
141 |
configuration recommends that you change your root password as soon as |
142 |
possible. We will definitely do this, otherwise someone could come along by |
143 |
chance and hack our default setup MySQL server. |
144 |
</p> |
145 |
|
146 |
<pre caption="MySQL configuration"> |
147 |
# <i>ebuild /var/db/pkg/dev-db/mysql-[version]/mysql-[version].ebuild config</i> |
148 |
* MySQL DATADIR is /var/lib/mysql |
149 |
* Press ENTER to create the mysql database and set proper |
150 |
* permissions on it, or Control-C to abort now... |
151 |
|
152 |
Preparing db table |
153 |
Preparing host table |
154 |
Preparing user table |
155 |
Preparing func table |
156 |
Preparing tables_priv table |
157 |
Preparing columns_priv table |
158 |
Installing all prepared tables |
159 |
|
160 |
To start mysqld at boot time you have to copy support-files/mysql.server |
161 |
to the right place for your system |
162 |
|
163 |
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER ! |
164 |
To do so, issue the following commands to start the server |
165 |
and change the applicable passwords: |
166 |
<comment>(Note the next 3 lines)</comment> |
167 |
/etc/init.d/mysql start |
168 |
/usr/bin/mysqladmin -u root -h pegasos password 'new-password' |
169 |
/usr/bin/mysqladmin -u root password 'new-password' |
170 |
Depending on your configuration, a -p option may be needed |
171 |
in the last command. See the manual for more details. |
172 |
|
173 |
<comment>(Some MySQL non-ebuild specific information has been removed from here |
174 |
so as to keep this document as consistent as possible)</comment> |
175 |
|
176 |
* For security reasons you should set your MySQL root |
177 |
* password as soon as possible. |
178 |
</pre> |
179 |
|
180 |
<impo> |
181 |
As of mysql-4.0.24-r2, passwords are entered during the config phase making |
182 |
root password entry more secure. |
183 |
</impo> |
184 |
|
185 |
<p> |
186 |
The config script has already printed out the commands we need to run to setup |
187 |
our password, so we shall now run them. |
188 |
</p> |
189 |
|
190 |
<pre caption="Setting up your MySQL root password"> |
191 |
# <i>/etc/init.d/mysql start</i> |
192 |
* Re-caching dependency info (mtimes differ)... |
193 |
* Starting mysqld (/etc/mysql/my.cnf) ... [ ok ] |
194 |
<comment>(Replace new-password with your desired password)</comment> |
195 |
# <i>/usr/bin/mysqladmin -u root -h localhost password 'new-password'</i> |
196 |
</pre> |
197 |
|
198 |
<p> |
199 |
You can now test that your root password was successfully configured by trying |
200 |
to login to your MySQL server: |
201 |
</p> |
202 |
|
203 |
<pre caption="Logging into the MySQL server using mysql"> |
204 |
$ <i>mysql -u root -h localhost -p</i> |
205 |
Enter password: |
206 |
Welcome to the MySQL monitor. Commands end with ; or \g. |
207 |
Your MySQL connection id is 4 to server version: 4.0.24-debug |
208 |
|
209 |
Type 'help;' or '\h' for help. Type '\c' to clear the buffer. |
210 |
|
211 |
mysql> |
212 |
</pre> |
213 |
|
214 |
<p> |
215 |
The <c>-u</c> switch sets the user that will be logging in. The <c>-h</c> |
216 |
switch sets the host. This will usually be <c>localhost</c> unless you are |
217 |
setting up a remote server. Finally, <c>-p</c> tells the mysql client that you |
218 |
will be entering a password to access your database. Notice the |
219 |
<c>mysql></c> prompt. This is where you type in all your commands. Now that |
220 |
we're in the mysql prompt as the root user, we can begin to setup our database. |
221 |
</p> |
222 |
|
223 |
</body> |
224 |
</section> |
225 |
</chapter> |
226 |
|
227 |
<chapter> |
228 |
<title>Setting Up The Database</title> |
229 |
<section> |
230 |
<title>Creating A Database</title> |
231 |
<body> |
232 |
|
233 |
<p> |
234 |
We have logged in and a mysql prompt is displayed. First let's take a look at |
235 |
the databases we currently have. To do so, we use the <c>SHOW DATABASES</c> |
236 |
command. |
237 |
</p> |
238 |
|
239 |
<pre caption="Displaying MySQL databases"> |
240 |
mysql> <i>SHOW DATABASES;</i> |
241 |
+----------+ |
242 |
| Database | |
243 |
+----------+ |
244 |
| mysql | |
245 |
| test | |
246 |
+----------+ |
247 |
2 rows in set (0.09 sec) |
248 |
</pre> |
249 |
|
250 |
<impo> |
251 |
Please remember that MySQL commands should end with a semicolon -- <c>;</c> |
252 |
</impo> |
253 |
|
254 |
<p> |
255 |
Despite the fact that a test database is already created, we are going to |
256 |
create our own. Databases are created using the <c>CREATE DATABASE</c> command. |
257 |
We'll create one named "gentoo". |
258 |
</p> |
259 |
|
260 |
<pre caption="Creating the gentoo database"> |
261 |
mysql> <i>CREATE DATABASE gentoo;</i> |
262 |
Query OK, 1 row affected (0.08 sec) |
263 |
|
264 |
|
265 |
|
266 |
-- |
267 |
gentoo-doc-cvs@g.o mailing list |