ข้ามไปที่เนื้อหาหลัก

Standalone MySQL setup

Currently I am learning Spring Boot. I follow some tutorials but there is a part requires to use DBMS. So I decide to use MySQL as a database. But I don't want to install it as as service neither install with Windows installer.

I decide to download an archive version to run it as standalone application. I expect it will be ready to use as the installer version but it is not as easy as I think.

The first thing you have to do after extract the archive file is to copy my-default.ini to my.ini
Open my.ini with notepad or text editor that you like, edit these lines as show below

basedir = X:/<pat to your mysql folderh>/mysql-5.7.9-winx64
datadir = X:/<pat to your mysql folderh>/mysql-5.7.9-winx64/data
Important! Don't forget to create the folder data to the path they you refer in datadir 

Second you have to mysql bin directory and then input the following command in command prompt
mysqld --initialize --console
--console is optional to see the verbose in command prompt

If you forget this step the mysql daemon will prompt some error on about cannot find table mysql.user and mysql.plugin etc. Because there is no database has been initialized yet.

Once it has finished the command prompt will let you know the temporary password, use that password to log in with mysql client and change to another password as you desire with below command
SET password=PASSWORD('yourpasswordhere');
Next time you can log in with your new password.

ความคิดเห็น

โพสต์ยอดนิยมจากบล็อกนี้

Alfresco กับการ Search ภาษาไทย

เนื่องด้วยการ Search ถือเป็นหัวใจสำคัญของงาน ECM เลยก็ว่าได้ แต่ Alfresco ณ ปัจจุบันยังไม่รองรับการ Search ด้วยภาษาไทย แต่อย่างว่า Opensource เมื่อเรารู้ว่ามันใช้ Lucene เป็น engine ในการค้นหาเอกสาร เราก็เลยแงะไปยังตัว lucene เองพบว่ามีคนส่ง Patch ในการตัดคำไทย ไปให้กับ lucene เรียบร้อยแล้ว โดยคุณสัมพันธ์นั่นเอง วิธีการ Config ให้ Alfresco ตัดคำไทยได้ผมสรุปออกมาเป็นขั้นตอนได้ดังนี้ครับ ไปเพิ่ม Locale ให้ Alfresco รู้จัก ใน tomcat/shared/classes/alfresco/extension/web-client-config-custom.xml ตรง tag <languages> เพิ่ม <language locale="th_TH">Thai</language> เข้าไป directory: tomcat/webapps/alfresco/WEB-INF/classes/alfresco/model แล้วทำการ copy file dataTypeAnalyzers_fr.properties หรือไฟล์อื่นก็ได้ เปลี่ยนชื่อเป็น dataTypeAnalyzers_th.properties แล้วเปิดไฟล์ขึ้นมาแก้ไขให้เป็น d_dictionary.datatype.d_text.analyzer=org.apache.lucene.analysis.th.ThaiAnalyzer d_dictionary.datatype.d_content.analyzer=org.apache.lucene.analysis.th.ThaiAnalyzer หลังจากนั้นเมื่อทำการ...

Spring Roo vs Grails

Spring Roo หรือ Grails ดี ถ้าต้องเลือกระหว่างสองตัวนี้จะเลือกอะไรดี คำตอบแบ่งออกได้เป็นสองส่วน ส่วนแรกคือภาษาที่ถนัด หากใครเขียน Java อยู่แล้วไม่อยากเปลี่ยนก็ควรจะเลือก Spring Roo หากใครต้องการ magic ที่มากับ Dynamic Language ก็คิดว่าน่าจะใช้ Grails มากกว่า ส่วนที่สองคือ ความเร็วในการพัฒนาเนื่องจาก magic ที่มาจากภาษา Groovy ทำให้เราพัฒนา Application ได้เร็วกว่าภาษา Java (แต่อันนี้ก็แล้วแต่ความถนัก หากถนัด Java มากๆ ก็อาจจะเร็วกว่าก็ได้) แต่ส่วนที่คิดว่าเร็วกว่าแน่ๆ คือมันจะ Generate Method ส่วนใหญ่ให้ในขณะ Runtime เช่น findBookById() ซึ่งจะไม่มีโค้ดในส่วนนี้แต่จะเป็นการ Generate ให้เองจากตัว Framework แต่หากใช้ Spring Roo เราต้องมานั่งเขียน Method ส่วนนี้เอง ข้อดี ข้อเสีย Grails อย่างที่รู้ว่า Groovy นั้นจะ Generate Method ระหว่าง Runtime ให้และยังเป็นภาษา Script แม้จะมีการ Compile ให้เป็น Bytecode ของจาวาแล้วก็ตาม แต่ Performance ก็จะด้อยกว่า Pure Java อยู่ดี Spring Roo จะช้าในช่วง Develop time แต่ขณะ Runtime จะมี Performance ดีกว่า Grails เนื่องจากไม่มีส่วนที่ต้องสร้างขึ้นระหว่าง ...

เปลี่ยนเว็บเดิมให้ Pluggable ด้วย OSGi

เป็นบทความภาษาอังกฤษครับลองอ่านดู เปลี่ยน Web application เดิมให้ยืดหยุ่นด้วย OSGi เพิ่มเติ่มให้ครับ OSGi คืออะไร เป็น Specification ครับที่เจ้าใหญ่ของ Java เค้าทำมาเพื่อให้เกิดความเป็น modularized ครับ ซึ่งถ้าจะให้เห็นภาพคือการทำงานของ plugin น่ะครับ ที่เราสามารถเปิดปิดการทำงานของมันได้ตลอดเวลาเมื่อเอามาใส่ web application ก็ทำให้เราสามารถถอดหรือเสียบ plugin ใหม่ๆ ได้ตลอดเวลา โดยที่ plugin นี้ใน OSGi จะเรียกว่า module ครับ หรือถ้าเป็นศัพท์เทคนิคเค้าจะเรียกว่า Bundle ครับ ลองไปอ่านบทความกันดูครับ ซึ่ง OSGi นั้นจริงๆ แล้วมันเป็น Specification เหมือนกับ EJB หรือ Servlet นี่แหละครับ แต่ตัว implement นั้นแล้วแต่ว่าใครจะนำไป implement นะครับ ที่ดังๆ อยู่ในตอนนี้ก็เห็นมีอยู่สองสามเจ้า Equinox อันนี้หลายๆ คนคงจะคุ้นเคยกันดีมันคือเจ้า eclipse ของเรานั่นเองใช้ตัวนี้อยู่ครับ ส่วนอีกตัวเป็นของ Apache Felix ครับ ลักษณะการใช้งานจะแตกต่างกันบาง และตัว module อาจจะเรียกไม่เหมือนกันบางอันเป็น Bundle บางอันอาจไม่ใช่ ผมก็จำไม่ได้แล้วเหมือนกันครับ ลองไปศึกษากันดูครับ น่าสนใจทีเดียว อีกตัวนั้นจะเป็นของ Sp...