user-img
๐Ÿ‘ฉ‍๐Ÿ’ปํ”„๋กœ๊ทธ๋ž˜๋ฐ&DB 52
ERROR 2002 (HY000) : Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2)
https://shifeed.tistory.com/entry/%EC%9A%B0%EB%B6%84%ED%88%AC%EC%97%90%EC%84%9C-mysqlsock%EB%A5%BC-%EC%B0%BE%EC%9D%84-%EC%88%98-%EC%97%86%EB%8B%A4%EA%B3%A0-%EB%82%98%EC%98%AC%EB%95%8C ์šฐ๋ถ„ํˆฌ์—์„œ mysql.sock๋ฅผ ์ฐพ์„ ์ˆ˜ ์—†๋‹ค๊ณ  ๋‚˜์˜ฌ๋•Œ. sudo find / -type s | grep mysqld.sock ๋กœ ์ฐพ์•„๋ด๋„ mysqld๊ฐ€ ์—†๋‹ค๊ณ  ๋‚˜์˜ค๋Š” ๊ฒฝ์šฐ๊ฐ€ ์žˆ๋‹ค. sudo mkdir -p /var/run/mysqld sudo chown mysql /var/run/mysqld/ sudo service mysql restart ์œ„์˜ ๋ช…๋ น์–ด๋กœ ์‹คํ–‰ํ•˜๋ฉด mysql์„ ์‹ค..
2023.12.04
๐Ÿ‘ฉ‍๐Ÿ’ปํ”„๋กœ๊ทธ๋ž˜๋ฐ&DB/mysql
thumbnail
[JAVA] ์ด๋ฒคํŠธ ๊ธฐ๋ฐ˜ ํ”„๋กœ๊ทธ๋ž˜๋ฐ
ActionEvent ๋ฒ„ํŠผ์„ ํด๋ฆญํ•ด ํ•œ์˜, ์˜ํ•œ ์ „ํ™˜์„ ์‹œํ‚ค๋Š” ์ด๋ฒคํŠธ๋ฅผ ๋งŒ๋“ค์–ด๋ณด์ž. import java.awt.Container; import java.awt.FlowLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; //๋…๋ฆฝํด๋ž˜์Šค๋กœ ActionListener ๋งŒ๋“ค๊ธฐ class MyActionListener implements ActionListener{ @Override public void actionPerformed(ActionEvent e) { JButton b = (JButton)e.getSource();..
2023.12.01
๐Ÿ‘ฉ‍๐Ÿ’ปํ”„๋กœ๊ทธ๋ž˜๋ฐ&DB/Java
thumbnail
[JAVA] Swing(์Šค์œ™) ์œผ๋กœ ์ปจํ…Œ์ด๋„ˆ, ์ปดํฌ๋„ŒํŠธ ๊ธฐ๋ณธ ๋ฐฐ์น˜
์ปจํ…Œ์ด๋„ˆ: ๋‹ค๋ฅธ ์ปดํฌ๋„ŒํŠธ๋ฅผ ํฌํ•จํ•  ์ˆ˜ ์žˆ๋Š” ์ปดํฌ๋„ŒํŠธ ์ปดํฌ๋„ŒํŠธ: ์ปจํ…Œ์ด๋„ˆ์— ํฌํ•จ๋˜์–ด์•ผ ํ™”๋ฉด์— ์ถœ๋ ฅ๋  ์ˆ˜ ์žˆ๋Š” ์ˆœ์ˆ˜ ์ปดํฌ๋„ŒํŠธ ์Šค์œ™ ํ”„๋ ˆ์ž„ ์ œ๋ชฉ ํ‘œ์‹œ์ค„, ์ปจํ…์ธ  ํŽ˜์ด์ง€ import javax.swing.JFrame; public class FrameEx extends JFrame{ FrameEx(){ setTitle("First Frame");//์ฐฝ ๋ฉ”์ธ ํƒ€์ดํ‹€ ์ด๋ฆ„ setSize(300,300);//์ฐฝ ์‚ฌ์ด์ฆˆ ์„ค์ • setVisible(true);//์ฐฝ ๋ณด์ด๊ธฐ ์—ฌ๋ถ€ } public static void main(String[] args) { new FrameEx(); } } ๋ฉ”์ธ ํ•จ์ˆ˜๋ฅผ ํฌํ•จํ•œ ์ „์ฒด ํผ๋ธ”๋ฆญ ํด๋ž˜์Šค์—์„œ ํ•จ๊ป˜ ์ž‘์„ฑํ•˜๋Š” ๊ฒƒ์ด ๊ถŒ์žฅ๋จ. 3๊ฐœ์˜ ๋ฒ„ํŠผ์„ ๊ฐ€์ง„ ์ปดํฌ๋„ŒํŠธ import java.awt.Colo..
2023.12.01
๐Ÿ‘ฉ‍๐Ÿ’ปํ”„๋กœ๊ทธ๋ž˜๋ฐ&DB/Java
์ •๊ทœํ™” ์ •๋ฆฌ ๋ฌธ์ œ ์˜ˆ์ œ
๋ณดํ˜ธ๋˜์–ด ์žˆ๋Š” ๊ธ€์ž…๋‹ˆ๋‹ค.
2023.11.27
๐Ÿ‘ฉ‍๐Ÿ’ปํ”„๋กœ๊ทธ๋ž˜๋ฐ&DB/db
DB ์ •๊ทœํ™”
์ด์ƒํ˜„์ƒ ์‚ญ์ œ์ด์ƒ(deletion anomaly) : ํˆฌํ”Œ ์‚ญ์ œ ์‹œ ๊ฐ™์ด ์ €์žฅ๋œ ๋‹ค๋ฅธ ์ •๋ณด๊นŒ์ง€ ์—ฐ์‡„์ ์œผ๋กœ ์‚ญ์ œ๋˜๋Š” ํ˜„์ƒ → ์—ฐ์‡„์‚ญ์ œ ๋ฌธ์ œ ๋ฐœ์ƒ ์‚ฝ์ž…์ด์ƒ(insertion anomaly) : ํˆฌํ”Œ ์‚ฝ์ž… ์‹œ ํŠน์ • ์†์„ฑ์— ํ•ด๋‹นํ•˜๋Š” ๊ฐ’์ด ์—†์–ด NULL ๊ฐ’์„ ์ž…๋ ฅํ•ด์•ผ ํ•˜๋Š” ํ˜„์ƒ → NULL ๊ฐ’ ๋ฌธ์ œ ๋ฐœ์ƒ ์ˆ˜์ •์ด์ƒ(update anomaly) : ํˆฌํ”Œ ์ˆ˜์ • ์‹œ ์ค‘๋ณต๋œ ๋ฐ์ดํ„ฐ์˜ ์ผ๋ถ€๋งŒ ์ˆ˜์ •๋˜์–ด ๋ฐ์ดํ„ฐ์˜ ๋ถˆ์ผ์น˜ ๋ฌธ์ œ๊ฐ€ ์ผ์–ด๋‚จ → ๋ถˆ์ผ์น˜(inconsistency) ๋ฌธ์ œ ๋ฐœ์ƒ ๊ฒ€์ƒ‰ํ•  ๋•Œ ์‹ค์ˆ˜ํ•  ์—ฌ์ง€๊ฐ€ ์žˆ๋‹ค! ํ•ด๊ฒฐ๋ฒ• ํ…Œ์ด๋ธ” ๋ถ„๋ฆฌ ํ•จ์ˆ˜ ์ข…์†์„ฑ A๊ฐ’์„ ์•Œ๋ฉด B์˜ ๊ฐ’์ด ์œ ์ผํ•˜๊ฒŒ ์ •ํ•ด์ง€๋Š” ์˜์กด ๊ด€๊ณ„. ์†์„ฑ B๋Š” A์— ์ข…์†ํ•œ๋‹ค(dependent) ๋˜๋Š” ์†์„ฑ A๋Š” B๋ฅผ ๊ฒฐ์ •ํ•œ๋‹ค(determine) A→B๋กœ ํ‘œ๊ธฐ. A๋Š” B์˜ ๊ฒฐ์ •์ž. ..
2023.11.27
๐Ÿ‘ฉ‍๐Ÿ’ปํ”„๋กœ๊ทธ๋ž˜๋ฐ&DB/db
thumbnail
[JAVA] file ํด๋ž˜์Šค
File ํด๋ž˜์Šค ํŒŒ์ผ์˜ ์ •๋ณด๋ฅผ ๋‹ค๋ฃจ๋Š” ํด๋ž˜์Šค File f = new File("์œ„์น˜์ •๋ณด"); ํŒŒ์ผ ๊ฐ์ฒด ์ƒ์„ฑ ์ด๋ฏธ ํŒŒ์ผ์€ ์กด์žฌํ•˜๋Š”๋ฐ ๊ทธ ํŒŒ์ผ์„ ๋‹ค๋ฃจ๊ธฐ ์œ„ํ•ด ํŒŒ์ผ "๊ฐ์ฒด"๋ฅผ ์ƒ์„ฑํ•˜๋Š” ๊ฑฐ์ž„. ํŒŒ์ผ ๊ตฌ๋ถ„ํ•˜๊ณ  ํŒŒ์ผ ๊ฐ์ฒด ์ƒ์„ฑ, ๋””๋ ‰ํ† ๋ฆฌ ๋งŒ๋“ค๊ธฐ, ํŒŒ์ผ ๋ฆฌ์ŠคํŠธ ์ถœ๋ ฅ import java.io.File; public class FileEx { static void listDir(File dir) { File[] sublist = dir.listFiles(); for(int i=0; i
2023.11.24
๐Ÿ‘ฉ‍๐Ÿ’ปํ”„๋กœ๊ทธ๋ž˜๋ฐ&DB/Java
thumbnail
[JAVA] ์ž…์ถœ๋ ฅ ์ŠคํŠธ๋ฆผ(FileReader, FileInputStream, FileWriter, FileOutputStream) + ๋ฒ„ํผ
-Stream: ๋ฐ”์ดํŠธ -reader, writer: ํ…์ŠคํŠธ FileReader ์‚ฌ์šฉ import java.io.FileReader; import java.io.IOException; public class FileReaderEx { public static void main(String[] args) { FileReader fin = null; try { fin = new FileReader("ascii"); int c; while((c = fin.read()) != -1) System.out.print((char) c); fin.close(); }catch(IOException e) {e.getMessage();} } } ascii ํŒŒ์ผ ๋‚ด์šฉ ์ถœ๋ ฅ๊ฐ’ ํŒŒ์ผ ๋‚ด์šฉ์— ํ•œ๊ธ€์„ ์ ์–ด๋„ ์ž˜ ์ถœ๋ ฅ๋œ๋‹ค. FileI..
2023.11.24
๐Ÿ‘ฉ‍๐Ÿ’ปํ”„๋กœ๊ทธ๋ž˜๋ฐ&DB/Java
๊ด€๊ณ„๋ฐ์ดํ„ฐ ๋ชจ๋ธ๋ง ์‹ค์Šต
๋ณดํ˜ธ๋˜์–ด ์žˆ๋Š” ๊ธ€์ž…๋‹ˆ๋‹ค.
2023.11.24
๐Ÿ‘ฉ‍๐Ÿ’ปํ”„๋กœ๊ทธ๋ž˜๋ฐ&DB/db
๊ด€๊ณ„ ๋ฐ์ดํ„ฐ ๋ชจ๋ธ๋กœ์˜ ์‚ฌ์ƒ
๋ณดํ˜ธ๋˜์–ด ์žˆ๋Š” ๊ธ€์ž…๋‹ˆ๋‹ค.
2023.11.20
๐Ÿ‘ฉ‍๐Ÿ’ปํ”„๋กœ๊ทธ๋ž˜๋ฐ&DB/db
thumbnail
[JAVA] ์ œ๋„ค๋ฆญ ๋งŒ๋“ค๊ธฐ
์ œ๋„ค๋ฆญ ํด๋ž˜์Šค์™€ ์ธํ„ฐํŽ˜์ด์Šค ๊ธฐ๋ณธ ์‚ฌ์šฉ class MyClass{ T val; void set(T a) { val = a; } T get(){ return val; } } ↑์ด๋Ÿฐ ์‹์˜ ๊ตฌ์กฐ ์œ„์˜ ๊ตฌ์กฐ์— ์ถ”๊ฐ€ํ•ด์„œ ์–ด๋–ค ์‹์œผ๋กœ ์‚ฌ์šฉํ•˜๋ƒ๋ฉด์€ //T ํƒ€์ž…์„ ์‚ฌ์šฉํ•˜๋Š” ์ œ๋„ค๋ฆญ ํด๋ž˜์Šค class MyClass{ T val; void set(T a) { val = a; } T get(){ return val; } } public class GenericClassEx { public static void main(String[] args) { //T๋ฅผ ๊ตฌ์ฒดํ™” MyClass my1 = new MyClass();//์ด ์‹œ์ ์—์„œ T๊ฐ€ String์œผ๋กœ ์‚ฌ์šฉ๋˜๋Š” ๊ฑฐ์ž„ MyClass my2 = new MyClass();//์—ฌ๊ธฐ์„œ๋Š” ..
2023.11.17
๐Ÿ‘ฉ‍๐Ÿ’ปํ”„๋กœ๊ทธ๋ž˜๋ฐ&DB/Java
thumbnail
[JAVA] LinkedList&Collections ํด๋ž˜์Šค ํ™œ์šฉ ์˜ˆ์ œ
LinkedList&Collections ํด๋ž˜์Šค ํ™œ์šฉ ์˜ˆ์ œ ์ถ”๊ฐ€์ ์œผ๋กœ Iterator ํ™œ์šฉํ•ด๋ณด๊ธฐ import java.util.Collections; import java.util.Iterator; import java.util.LinkedList; public class LinkedListEx { static void printList(LinkedList list) { Iterator it = list.iterator(); while(it.hasNext()) { System.out.print(it.next()+" "); } System.out.println(""); } public static void main(String args[]) { LinkedList myList = new LinkedList..
2023.11.17
๐Ÿ‘ฉ‍๐Ÿ’ปํ”„๋กœ๊ทธ๋ž˜๋ฐ&DB/Java
[ํŒŒ์ด์ฌ] .split ์‚ฌ์šฉ๋ฒ•
Python ๋ฌธ์ž์—ด์—์„œ ์‚ฌ์šฉ, ์ž˜๋ผ์„œ ๋ฆฌ์ŠคํŠธ๋กœ ๋งŒ๋“ค์–ด์คŒ. ๋ฌธ์ž์—ด.split(): ๋„์–ด์“ฐ๊ธฐ, ์—”ํ„ฐ๋ฅผ ๊ตฌ๋ถ„ํ•˜์—ฌ ๋ถ„ํ• ํ•จ. ๋ฌธ์ž์—ด.split('๊ตฌ๋ถ„์ž'): ๊ตฌ๋ถ„์ž๋ฅผ ๊ธฐ์ค€์œผ๋กœ ๋‚˜๋ˆ”.(๋งŒ์•ฝ ๊ตฌ๋ถ„์ž๊ฐ€ /์ด์—ˆ๋‹ค๋ฉด /๋Š” ์—†์–ด์ง€๊ณ  ๊ทธ ์–‘์ชฝ์ด ๋ถ„ํ• ๋จ) ๋ฌธ์ž์—ด.split('๊ตฌ๋ถ„์ž', ๋ถ„ํ• ํšŸ์ˆ˜): ์œ„์™€ ๋™์ผํ•˜์ง€๋งŒ ๋ถ„ํ• ํšŸ์ˆ˜+๋‚˜๋จธ์ง€ ํ†ต์œผ๋กœ ๋œ ๋ฆฌ์ŠคํŠธ๋กœ ๋‚˜๋‰œ๋‹ค.(๋”ฐ๋ผ์„œ ๊ฐฏ์ˆ˜๋Š” ๋ถ„ํ• ํšŸ์ˆ˜+1) ๋ฌธ์ž์—ด.split(sep='๊ตฌ๋ถ„์ž', maxsplit=๋ถ„ํ• ํšŸ์ˆ˜): ์œ„์™€ ๋™์ผ. ์ง์ ‘ ์ง€์ •ํ•ด์ฃผ์–ด์„œ ์ •ํ™•ํ•˜๋‹ค. ๊ด„ํ˜ธ ์•ˆ ์ „์ž๋‚˜ ํ›„์ž๋งŒ ์ด ๋ฐฉ์‹์œผ๋กœ ์“ธ ์ˆ˜๋„ ์žˆ๋‹ค.
2023.11.17
๐Ÿ‘ฉ‍๐Ÿ’ปํ”„๋กœ๊ทธ๋ž˜๋ฐ&DB/Python