Categories
Database Linux Ubuntu การพัฒนาซอฟท์แวร์

reset password MySql

Why are you looking at this wiki page?

Are you looking at this page because you cannot access the mysql server installed on your pc/server when you were trying to see if it works well? Or do you receive error messages like the following? :

ERROR 1045: Access denied for user: 'root@localhost' (Using 
password: NO)

or

ERROR 1045: Access denied for user: 'root@localhost' (Using 
password: YES)

To resolve this problem ,a fast and always working way is the “Password Resetting” .

Categories
Database Linux Ubuntu Web site การพัฒนาซอฟท์แวร์

ลง LAMP Server บน Ubuntu

This tutorial was has been tested on Ubuntu 10.04, 10.10, 11.04, 11.10, 12.04 LTS Precise Pangolin. Also tested in LinuxMint13 and works fine.

Open terminal and Type the command :install it   first  with

sudo apt-get install tasksel

Now to install LAMP, type the taskel command in terminal :

sudo  tasksel

And select LAMP Server:

During the installation  you  will be  asked  to insert the  mysql root  password

Now check if php is working :

$sudo vi /var/www/info.php

and add

<?php
phpinfo();
?>

save and exit

restart apache2 ,

#sudo /etc/init.d/apache2 restart

Now open browser and type :

http://ip/info.php or http://localhost/info.php

Php is installed.

To full manage  your  lamp Server database, install  phpmyadmin

sudo  apt-get  install  phpmyadmin

To login  to phpmyadmin, open browser and type :

http://ip/phpmyadmin   or http://localhost/phpmyadmin

 

– ที่มา http://www.unixmen.com/install-lamp-with-1-command-in-ubuntu-1010-maverick-meerkat/

Categories
Database

[MySQL] MyISAM กับ InnoDB ต่างกันอย่างไร?

ต่อจากตอนที่แล้ว พอมาใช้ PDO แล้วชีวิตมันก็ดีขึ้นตามลำดับ ที่ควรจะเป็น แต่มาติดปัญหาเรื่อง Transaction นิดหน่อย เนื่องมาจากตารางที่ออกแบบมานั้น (คนอื่นออกแบบมาอีกที) ใช้ engine เป็น MyISAM ซึ่งเท่าที่อ่านมาคือมันไม่รองรับการทำ transaction ผมไม่รู้เสียเวลา่ตั้งนานว่าเขียน Code ผิดตกหล่นตรงไหนนี่ สั่ง rollback ก็แล้ว ข้อมูลก็ยังมาอยู่ดี จนสุดท้ายลองไปดูโครงสร้างของ table โอ้ๆๆ ถึงบางอ้อเลย เลยลองเปลี่ยนมาเป็น InnoDB แล้วทุกอย่างก็เป็นไปอย่างที่คิดไม่มีผิด

ISAM (MyISAM) ซึ่งมีความรวดเร็วในการอ่านและเขียนสูง เนื่องจากมีการจัดเก็บไว้ในรูปแบบของแฟ้มข้อมูล ซึ่งรองรับการอ่านข้อมูลพร้อมๆ กันได้ (เหมาะสำหรับ Web Application) แต่อาจจะมีปัญหาเมื่อใช้งานกับระบบที่ต้องมีการอ่าน/เขียน ข้อมูลในตารางเดียวกัน พร้อมๆ กันที่สำคัญ ฐานข้อมูลประเภท MyISAM จะมีปัญหาเรื่อง Index เสีย และ Data Corrupt บ่อยมาก หากใช้งานใน OS ที่เป็น Windows และมีการ Shutdown อย่างไม่ถูกต้อง ซึ่งทำให้ผู้ดูแลระบบต้องมีการซ่อมแซม (repair table bad_table) ตารางทีมีปัญหาอยู่เรื่อยๆ
InnoDB ข้อดีคือ รองรับการทำ Transaction รองรับการอ่านและเขียน พร้อมๆ กันได้ดีกว่าฐานข้อมูลประเภท MyISAM และยังมีระบบ Auto Data Recovery หากมีการ shutdown โดยไม่เหมาะสม (ไฟดับ)ซึ่งในการใช้งานผู้ใช้สามารถเลือกได้ว่าจะให้ตารางใดเป็นประเภท InnoDB หรือ MyISAM ขึ้นอยู่กับความเหมาะสม (ว่าจะเลือกความเร็ว หรือ ประสิทธิภาพ)

ที่มา: http://www.secondknow.com/2010/467/mysql-myisam-%E0%B8%81%E0%B8%B1%E0%B8%9A-innodb/

Categories
Database

utf8_unicode_ci กับ utf8_general_ci ต่างกันอย่างไร?

utf8_unicode_ci มีการเรียงลำดับที่ดีกว่า

utf8_general_ci จะทำงานได้เร็วกว่า