{"id":881,"date":"2009-10-03T09:27:00","date_gmt":"2009-10-03T08:27:00","guid":{"rendered":"http:\/\/it4bus.vn\/itersdesktop\/2009\/10\/03\/installing-php5-mysql-and-apache-on-ubuntu\/"},"modified":"2013-10-24T20:53:15","modified_gmt":"2013-10-24T19:53:15","slug":"installing-php5-mysql-and-apache-on-ubuntu","status":"publish","type":"post","link":"https:\/\/www.itersdesktop.com\/vi\/2009\/10\/03\/installing-php5-mysql-and-apache-on-ubuntu\/","title":{"rendered":"Installing PHP5, MySQL and Apache on Ubuntu"},"content":{"rendered":"<p>\u0110\u1ec3 l\u1eadp tr\u00ecnh web s\u1eed d\u1ee5ng PHP v\u00e0 MySQL tr\u00ean Ubuntu, ch\u00fang ta n\u00ean s\u1eed d\u1ee5ng <a href=\"http:\/\/www.apachefriends.org\/en\/xampp.html\" target=\"_blank\">XAMPP<\/a>. Xem tr\u00ean trang n\u00e0y, ch\u00fang ta s\u1ebd bi\u1ebft c\u00e1ch c\u00e0i \u0111\u1eb7t. Kh\u00e1 \u0111\u01a1n gi\u1ea3n v\u00ec ch\u00fang ta ch\u1ec9 c\u1ea7n c\u00e0i g\u00f3i <a href=\"http:\/\/www.apachefriends.org\/en\/xampp-linux.html\" target=\"_blank\">XAMPP d\u00e0nh cho Linux<\/a> n\u00ean vi\u1ec7c c\u1ea5u h\u00ecnh c\u00f2n l\u1ea1i ch\u1ec9 l\u00e0 s\u1eed d\u1ee5ng xampp nh\u01b0 th\u1ebf n\u00e0o cho \u0111\u00fang.<\/p>\n<p>Tuy nhi\u00ean, ngo\u00e0i nh\u1eefng b\u01b0\u1edbc ki\u1ec3m tra nh\u01b0 trong c\u00e1c trang c\u00e0i \u0111\u1eb7t, ch\u00fang ta c\u1ea7n ki\u1ec3m tra th\u00eam m\u1ed9t v\u00e0i th\u1ee9 nh\u01b0 sau:<\/p>\n<p>R\u00f5 r\u00e0ng, n\u1ebfu ch\u00fang ta \u0111\u00e3 c\u00e0i \u0111\u1eb7t <b>XAMPP<\/b> th\u00ec kh\u00f4ng c\u1ea7n thi\u1ebft ph\u1ea3i c\u00e0i \u0111\u1eb7t ri\u00eang t\u1eebng g\u00f3i nh\u01b0 PHP, MySQL hay Apache&#8230; V\u00ec th\u1ebf, t\u1eeb b\u1ea5t k\u1ef3 v\u1ecb tr\u00ed n\u00e0o ngo\u00e0i \/opt\/lampp\/bin, ch\u00fang ta g\u00f5 mysql -u root -p (sau \u0111\u00f3 y\u00eau c\u1ea7u password) th\u00ec c\u00f3 ngh\u0129a l\u00e0 tr\u00ean m\u00e1y b\u1ea1n \u0111\u00e3 c\u00f3 mysql.<\/p>\n<p>C\u00f3 v\u1ea5n \u0111\u1ec1 t\u00f4i g\u1eb7p ph\u1ea3i l\u00e0:<\/p>\n<ol>\n<li>T\u00f4i c\u00e0i v\u00e0 d\u00f9ng MySQL Query Browser v\u00e0 MySQL Administrator, m\u1ed7i khi kh\u1edfi \u0111\u1ed9i m\u1ed9t trong hai ch\u01b0\u01a1ng tr\u00ecnh n\u00e0y \u0111\u1ec1u y\u00eau c\u1ea7u cung c\u1ea5p Username v\u00e0 Password.<\/li>\n<li>C\u1ea5u h\u00ecnh phpmyadmin: m\u1ed7i l\u1ea7n \u0111\u0103ng nh\u1eadp hay h\u1ecfi m\u1eadt kh\u1ea9u. L\u1ed7i c\u0169ng gi\u1ed1ng nh\u01b0 tr\u01b0\u1eddng h\u1ee3p 3.<\/li>\n<li>Ch\u1ea1y mysql t\u1eeb console, kh\u00f4ng cho root \u0111\u0103ng nh\u1eadp. L\u1ed7i:\u00a0<span><b><span><span>ERROR 1045 (28000): Access denied for user &#8216;root&#8217;@&#8217;localhost&#8217; (using password: NO)<\/span><\/span><\/b><\/span>\n<\/li>\n<\/ol>\n<div>\n<span><b>C\u00e1c t\u00ecnh hu\u1ed1ng l\u1ed7i hay g\u1eb7p:<\/b><\/span><br \/><b><span><span><i>L\u1ed7i 01:<\/i><\/span><\/span><\/b><br \/><b><span><span><i>mysqladmin: connect to server at \u2018localhost\u2019 failed<br \/>error: \u2018Can\u2019t connect to local MySQL server through socket \u2018\/var\/run\/mysqld\/mysqld.sock\u2019 (2)\u2019<br \/>Check that mysqld is running and that the socket: \u2018\/var\/run\/mysqld\/mysqld.sock\u2019 exists!<\/i><\/span><\/span><\/b><br \/><b><span><i><span><\/span><\/i><\/span><\/b><br \/><b><span><i>Xem c\u00e1ch gi\u1ea3i quy\u1ebft t\u00ecnh hu\u1ed1ng 1<br \/>L\u1ed7i 02:<br \/>honey@honey:~$ mysqladmin create test<br \/>mysqladmin: connect to server at \u2018localhost\u2019 failed<br \/>error: \u2018Access denied for user \u2018honey\u2019@&#8217;localhost\u2019 (using password: NO)\u2019<\/i><\/span>  <\/b><span><b><span><i><span><\/span><\/i><\/span><\/b><\/span><b><span><i><br \/><\/i><\/span> <\/b><br \/><span><b><\/b><b><\/b><\/span><br \/><b><\/b><b><\/b><br \/><b><\/b><b><\/b><br \/><b><\/b><b><\/b><\/p>\n<div>\n<div><b><\/b><b><span><span><i>Xem c\u00e1ch gi\u1ea3i quy\u1ebft t\u00ecnh hu\u1ed1ng 2,3<\/i><\/span><\/span><\/b><\/div>\n<\/div>\n<p><span><b><\/b><b><\/b><\/span><br \/><span><b><\/b><b><\/b><\/span><br \/><span><b><\/b><b><\/b><\/span><\/p>\n<div><span><b><\/b><b><br \/><\/b><\/span><\/div>\n<p><span><b>Gi\u1ea3i quy\u1ebft t\u00ecnh hu\u1ed1ng 1:<\/b><\/span>\n<\/div>\n<div>Hay b\u00e1o l\u1ed7i l\u00e0 kh\u00f4ng kh\u1edfi \u0111\u1ed9ng \u0111\u01b0\u1ee3c file mysqld.sock. Th\u1ebf th\u00ec:<\/div>\n<div>\n<div>&#8211; T\u1ea1o th\u01b0 m\u1ee5c mysqld: sudo mkdir \/var\/run\/mysqld<\/div>\n<div>&#8211; Chuy\u1ec3n \u0111\u1ebfn th\u01b0 m\u1ee5c tr\u00ean: cd \/var\/run\/mysqld<\/div>\n<div>&#8211; T\u1ea1o m\u1ed9t shortcut: sudo ln -s \/opt\/lampp\/var\/mysql\/mysql.sock mysqld.sock<\/div>\n<\/div>\n<div><\/div>\n<div><b><span>Gi\u1ea3i quy\u1ebft t\u00ecnh hu\u1ed1ng 2:<\/span><\/b><\/div>\n<div>C\u1ee9 theo h\u01b0\u1edbng d\u1eabn v\u00e0 ch\u1ec9nh s\u1eeda nh\u01b0 sau:<\/div>\n<blockquote><p>This is What I did, assuming mysql server is already running\u00a0<\/p><\/blockquote>\n<div>\n<blockquote><p>and setup ok.\u00a0<\/p><\/blockquote>\n<p><span><\/span><br \/><span><\/span><br \/><span><\/span><br \/><span><\/span><br \/><span><\/span><br \/><span><\/span><br \/><span><\/span><br \/><span><\/span><br \/><span><\/span><\/p>\n<blockquote><p><span>edited the file \/etc\/my.cnf\u00a0<\/span><\/p><\/blockquote>\n<blockquote><p><span>at the [mysqld] section<\/span><\/p><\/blockquote>\n<blockquote><p><span>added this line:\u00a0<\/span><\/p><\/blockquote>\n<p><span><b><\/p>\n<blockquote><p><b>skip-grant-tables\u00a0<\/b><\/p><\/blockquote>\n<p><\/b><\/p>\n<blockquote><p>and restarted the server &#8230;.\u00a0<\/p><\/blockquote>\n<blockquote><p>That worked great!!!<\/p><\/blockquote>\n<p><\/span>\n<\/div>\n<p><b><span>Gi\u1ea3i quy\u1ebft t\u00ecnh hu\u1ed1ng 3:<\/span><\/b><br \/>N\u1ebfu \u0111\u00e3 gi\u1ea3i quy\u1ebft t\u00ecnh hu\u1ed1ng 2 xong th\u00ec 3 ok. H\u01b0\u1edbng d\u1eabn \u0111\u1ea7y \u0111\u1ee7 nh\u1ea5t xem tr\u00ean <a href=\"http:\/\/dev.mysql.com\/doc\/refman\/5.1\/en\/resetting-permissions.html\">trang n\u00e0y<\/a>.<br \/>+================================================================+<br \/>SAU \u0110\u00c2Y L\u00c0 C\u00c1C L\u1ec6NH \u0110\u1ea6U TI\u00caN D\u00d9NG TR\u00caN MYSQL<br \/>1. T\u1ea1o database:<br \/>a. D\u00f9ng: mysqladmin create T\u00ean_CSDL<br \/>b. \u0110\u0103ng nh\u1eadp v\u00e0o mysql: mysql -u root (ho\u1eb7c user kh\u00e1c c\u00f3 quy\u1ec1n t\u1ea1o database) -p &#8211;> enter, sau \u0111\u00f3 nh\u1eadp m\u1eadt kh\u1ea9u.<br \/>mysql>create database tasks;<br \/>Query OK, 1 row affected (0.00 sec)<br \/>2. S\u1eeda m\u1eadt kh\u1ea9u user: xem <a href=\"http:\/\/www.cyberciti.biz\/faq\/mysql-change-root-password\/\">trang n\u00e0y<\/a> \u0111\u1ea7y \u0111\u1ee7 h\u01a1n.<br \/>===================================================================<br \/>Tham kh\u1ea3o:<\/p>\n<div><a href=\"http:\/\/www.howtogeek.com\/howto\/ubuntu\/installing-php5-and-apache-on-ubuntu\/\" target=\"_blank\">Installing PHP5 and Apache on Ubuntu :: the How-To Geek<\/a><\/div>\n<div>\n<a href=\"http:\/\/www.howtogeek.com\/howto\/ubuntu\/install-mysql-server-5-on-ubuntu\/\" target=\"_blank\">Install MySQL Server 5 on Ubuntu :: the How-To Geek<\/a><br \/><a href=\"http:\/\/webdevcodex.com\/tutorial-installing-apache2-php5-mysql5-phpmyadmin3-windows-7-vista\/#configapache\">http:\/\/webdevcodex.com\/tutorial-installing-apache2-php5-mysql5-phpmyadmin3-windows-7-vista\/#configapache<\/a>\n<\/div>\n<div>Shared via\u00a0<a href=\"http:\/\/addthis.com\/\">AddThis<\/a>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u0110\u1ec3 l\u1eadp tr\u00ecnh web s\u1eed d\u1ee5ng PHP v\u00e0 MySQL tr\u00ean Ubuntu, ch\u00fang ta n\u00ean s\u1eed d\u1ee5ng XAMPP. Xem tr\u00ean trang n\u00e0y, ch\u00fang ta s\u1ebd bi\u1ebft c\u00e1ch c\u00e0i \u0111\u1eb7t. Kh\u00e1 \u0111\u01a1n&hellip; <\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,222],"tags":[193,295,79,89,570,294],"class_list":["post-881","post","type-post","status-publish","format-standard","hentry","category-web-engineering","category-web-programming","tag-apache","tag-database","tag-mysql","tag-php","tag-ubuntu","tag-web-server"],"_links":{"self":[{"href":"https:\/\/www.itersdesktop.com\/vi\/wp-json\/wp\/v2\/posts\/881","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.itersdesktop.com\/vi\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.itersdesktop.com\/vi\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.itersdesktop.com\/vi\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.itersdesktop.com\/vi\/wp-json\/wp\/v2\/comments?post=881"}],"version-history":[{"count":1,"href":"https:\/\/www.itersdesktop.com\/vi\/wp-json\/wp\/v2\/posts\/881\/revisions"}],"predecessor-version":[{"id":921,"href":"https:\/\/www.itersdesktop.com\/vi\/wp-json\/wp\/v2\/posts\/881\/revisions\/921"}],"wp:attachment":[{"href":"https:\/\/www.itersdesktop.com\/vi\/wp-json\/wp\/v2\/media?parent=881"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.itersdesktop.com\/vi\/wp-json\/wp\/v2\/categories?post=881"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.itersdesktop.com\/vi\/wp-json\/wp\/v2\/tags?post=881"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}