<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>SpaLinux.com &#187; Uncategorized</title>
	<atom:link href="http://spalinux.com/category/uncategorized/feed" rel="self" type="application/rss+xml" />
	<link>http://spalinux.com</link>
	<description>Resources for Relaxing Linux System Administrators</description>
	<lastBuildDate>Mon, 26 Jul 2010 09:51:19 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>ติดตั้ง MySQL บน Fedora 11</title>
		<link>http://spalinux.com/2009/06/install_mysql_on_fedora_11</link>
		<comments>http://spalinux.com/2009/06/install_mysql_on_fedora_11#comments</comments>
		<pubDate>Sat, 27 Jun 2009 10:48:02 +0000</pubDate>
		<dc:creator>editor</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[install mysql]]></category>

		<guid isPermaLink="false">http://spalinux.com/?p=818</guid>
		<description><![CDATA[ในบทความนี้จะอธิบายวิธีการติดตั้งและคอนฟิก MySQL บน Fedora 11 (x86_64) โดยทดสอบบนเครื่องที่ ติดตั้ง Fedora 11 แบบประหยัดพื้นที่สุด หมายเหตุ Fedora 11 ปรับปรุงเวอร์ชั่นมาใช้ MySQL เวอร์ชั่น 5.1 แล้ว ใส่แผ่นดีวีดี Fedora 11 แล้วติดตั้งไฟล์ rpm ต่อไปนี้ [root@fc11-64min ~]# mount /dev/scd0 /media/ mount: block device /dev/sr0 is write-protected, mounting read-only [root@fc11-64min ~]# cd /media/Packages/ [root@fc11-64min Packages]# rpm -i perl-DBI-1.607-2.fc11.x86_64.rpm [root@fc11-64min Packages]# rpm -i perl-DBD-MySQL-4.010-1.fc11.x86_64.rpm [root@fc11-64min Packages]# rpm [...]]]></description>
			<content:encoded><![CDATA[<p>ในบทความนี้จะอธิบายวิธีการติดตั้งและคอนฟิก MySQL บน Fedora 11 (x86_64) โดยทดสอบบนเครื่องที่ <a href="http://spalinux.com/2009/06/install_minimal_fedora_11">ติดตั้ง Fedora 11 แบบประหยัดพื้นที่สุด</a></p>
<p>หมายเหตุ Fedora 11 ปรับปรุงเวอร์ชั่นมาใช้ MySQL เวอร์ชั่น 5.1 แล้ว</p>
<p><span id="more-818"></span></p>
<p>ใส่แผ่นดีวีดี Fedora 11 แล้วติดตั้งไฟล์ rpm ต่อไปนี้</p>
<pre>[root@fc11-64min ~]# <strong>mount /dev/scd0 /media/
</strong>mount: block device /dev/sr0 is write-protected, mounting read-only
[root@fc11-64min ~]# <strong>cd /media/Packages/</strong></pre>
<pre>[root@fc11-64min Packages]# <strong>rpm -i perl-DBI-1.607-2.fc11.x86_64.rpm
</strong>[root@fc11-64min Packages]# <strong>rpm -i perl-DBD-MySQL-4.010-1.fc11.x86_64.rpm
</strong>[root@fc11-64min Packages]# <strong>rpm -i mysql-5.1.32-1.fc11.x86_64.rpm
</strong>[root@fc11-64min Packages]# <strong>rpm -i mysql-server-5.1.32-1.fc11.x86_64.rpm
</strong>[root@fc11-64min Packages]# <strong>cd</strong></pre>
<p>ตรวจสอบไฟล์ MySQL ที่ติดตั้งทั้งหมด</p>
<pre>[root@fc11-64min ~]# <strong>rpm -qa | grep -i mysql
</strong>mysql-server-5.1.32-1.fc11.x86_64
mysql-libs-5.1.32-1.fc11.x86_64
mysql-5.1.32-1.fc11.x86_64
perl-DBD-MySQL-4.010-1.fc11.x86_64</pre>
<p>ใช้คำสั่ง service เพื่อรันเซอร์วิส MySQL</p>
<pre>[root@fc11-64min ~]# <strong>service mysqld start
</strong>Initializing MySQL database:  Installing MySQL system tables...
090628  0:09:11 [Warning] Forcing shutdown of 2 plugins
OK
Filling help tables...
090628  0:09:11 [Warning] Forcing shutdown of 2 plugins
OK</pre>
<pre>To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system</pre>
<pre>PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:</pre>
<pre>/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h fc11-64min.spalinux.com password 'new-password'</pre>
<pre>Alternatively you can run:
/usr/bin/mysql_secure_installation</pre>
<pre>which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.</pre>
<pre>See the manual for more instructions.</pre>
<pre>You can start the MySQL daemon with:
cd /usr ; /usr/bin/mysqld_safe &amp;</pre>
<pre>You can test the MySQL daemon with mysql-test-run.pl
cd /usr/mysql-test ; perl mysql-test-run.pl</pre>
<pre>Please report any problems with the /usr/bin/mysqlbug script!</pre>
<pre>The latest information about MySQL is available at http://www.mysql.com/
Support MySQL by buying support/licenses from http://shop.mysql.com/</pre>
<pre>                                                           [  OK  ]
Starting MySQL:                                            [  OK  ]</pre>
<p>หากเป็นการรันเซอร์วิส MySQL ครั้งแรกจะมีข้อความต่างๆ ขึ้นมากมาย เหมือนข้างบน เพื่อแนะนำการรันเซอร์วิส พร้อมทั้งเตือนให้มีการเปลี่ยน password ในการใช้ฐานข้อมูล</p>
<p>วิธีการง่ายสุดในการเปลี่ยน password และแก้ไขคอนฟิกของ MySQL เพื่อความปลอดภัย คือการรันคำสั่ง mysql_secure_installation</p>
<p>ผลจากการใช้คำสั่ง mysql_secure_installation</p>
<ul>
<li>Set root password &#8211; เปลี่ยน password ของ root ในการ connect database</li>
<li>Remove anonymous users &#8211; ลบ anonymous user ออก คือบังคับทุก user ที่ connect database ต้องใส่ password</li>
<li>Disallow root login remotely &#8211; ปิดการเชื่อมต่อเป็น root จากเครื่องอื่น ใช้ได้จากเครื่องทีรัน mysql อยู่เท่านั้น</li>
<li>Remove test database and access to it &#8211; ลบ database ชื่อ &#8216;test&#8217;</li>
<li>Reload privilege tables now &#8211; reload ให้สิทธิต่างๆ ที่เพิ่งคอนฟิกไป มีผลทันที</li>
</ul>
<pre>[root@fc11-64min ~]# <strong>mysql_secure_installation</strong></pre>
<pre>NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!</pre>
<pre>In order to log into MySQL to secure it, we'll need the current
password for the root user.  If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.</pre>
<pre>Enter current password for root (enter for none):
OK, successfully used password, moving on...</pre>
<pre>Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.</pre>
<pre><span style="color: #0000ff;">Set root password? [Y/n] <strong>y</strong>
</span>New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
 ... Success!</pre>
<pre>By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.</pre>
<pre><span style="color: #0000ff;">Remove anonymous users? [Y/n] <strong>y</strong>
</span> ... Success!</pre>
<pre>Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.</pre>
<pre><span style="color: #0000ff;">Disallow root login remotely? [Y/n] <strong>y</strong>
</span> ... Success!</pre>
<pre>By default, MySQL comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.</pre>
<pre><span style="color: #0000ff;">Remove test database and access to it? [Y/n] <strong>y</strong>
</span> - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!</pre>
<pre>Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.</pre>
<pre><span style="color: #0000ff;">Reload privilege tables now? [Y/n] <strong>y</strong>
</span> ... Success!</pre>
<pre>Cleaning up...</pre>
<pre> </pre>
<pre>All done!  If you've completed all of the above steps, your MySQL
installation should now be secure.</pre>
<pre>Thanks for using MySQL!</pre>
<p>ทดลองใช้คำสั่ง mysql เพื่อ connect database หน้าจอจะฟ้องว่า ไม่สามารถเข้าได้ &#8220;access denied&#8221;</p>
<pre>[root@fc11-64min ~]# <strong>mysql
</strong>ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)</pre>
<p>ต้องระบุออปชั่น &#8216;-p&#8217; เพื่อใส่ password ด้วย</p>
<pre>[root@fc11-64min ~]# <strong>mysql -u root -p
</strong>Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 12
Server version: 5.1.32 Source distribution</pre>
<pre>Type 'help;' or '\h' for help. Type '\c' to clear the buffer.</pre>
<pre>mysql&gt; <strong>show databases;
</strong>+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
+--------------------+
2 rows in set (0.00 sec)</pre>
<pre>mysql&gt; <strong>exit</strong>
Bye
[root@fc11-64min ~]#</pre>
<h4>ข้อมูลอ้างอิง</h4>
<ul>
<li><a href="http://spalinux.com/2009/07/mysql_secure_installation_error_read-only_file_system">รัน mysql_secure_installation ขึ้น Read-only file system</a></li>
</ul>
<pre> </pre>
]]></content:encoded>
			<wfw:commentRss>http://spalinux.com/2009/06/install_mysql_on_fedora_11/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
