Files
2nd/10_Wiki/Dev/Topic_PHP/PHP_MySQL_Create_DB.md
T
Antigravity Agent 1cfd3bbb56 docs(10_Wiki): 위키 구조 정리 — 언어 튜토리얼 카테고리 폴더 제거 + 신규 자산 동기화
Topic_CSS/Topic_HTML/Topic_JavaScript/Topic_Prompt/Topic_Comfyui 등 기존 카테고리 폴더를 정리하고,
Topic_Graphic/Dev 등 신규 산출물과 Topics 내부 세션/메모리 기록을 동기화.
2026-07-05 00:10:59 +09:00

3.6 KiB

id, title, category, status, verification_status, canonical_id, aliases, duplicate_of, source_trust_level, confidence_score, created_at, updated_at, review_reason, merge_history, tags, raw_sources, applied_in, github_commit
id title category status verification_status canonical_id aliases duplicate_of source_trust_level confidence_score created_at updated_at review_reason merge_history tags raw_sources applied_in github_commit
php-mysql-create-db PHP MySQL Create DB Programming_Language draft conceptual
CREATE DATABASE
PHP MySQL DB 생성
B 0.89 2026-07-04 2026-07-04
php
programming
w3schools
mysql
database
https://www.w3schools.com/php/php_mysql_create.asp

PHP MySQL Create DB

🎯 한 줄 통찰 (One-line insight)

Connecting to CREATE a database omits the database-name argument entirely — new mysqli($servername, $username, $password) has only 3 arguments, unlike the 4-argument connection used everywhere else, since the database you're about to create doesn't exist yet to connect to. [S1]

🧠 핵심 개념 (Core concepts)

  • CREATE DATABASE dbname — the SQL command to create a database. [S1]
  • 3-argument connection for creation — no database name yet, since it doesn't exist. [S1]
  • Requires admin privileges — creating/deleting databases needs administrative access. [S1]
  • $conn->query($sql) (MySQLi OOP) — executes the CREATE DATABASE statement, returns true on success. [S1]
  • $conn->exec($sql) (PDO) — the PDO equivalent for executing a non-SELECT statement. [S1]

📖 세부 내용 (Details)

  • MySQLi OOP: $conn = new mysqli($servername, $username, $password); $sql = "CREATE DATABASE myDB"; if ($conn->query($sql) === TRUE) { echo "Database created successfully"; } else { echo "Error creating database: " . $conn->error; }. [S1]
  • MySQLi procedural: $conn = mysqli_connect($servername, $username, $password); if (mysqli_query($conn, $sql)) { echo "Database created successfully"; }. [S1]
  • PDO: $conn = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password); ... $conn->exec($sql); echo "Database created successfully"; — wrapped in try/catch(PDOException). [S1]

⚖️ 모순 및 업데이트 (Contradictions & updates)

소스에서 모순되는 정보는 특별히 없으나, DB 생성 시 연결 인자가 3개뿐이라는 점이 다른 모든 챕터의 4개 인자 패턴과 유일하게 다름. [S1]

🛠️ 적용 사례 (Applied in summary)

현재 발견된 실제 적용 사례가 없습니다 — myDB라는 이름의 데이터베이스를 생성하는 것이 이후 테이블 생성 챕터의 전제 조건이다. [S1]

💻 코드 패턴 (Code patterns)

Creating a database with only 3 connection arguments (PHP):

$conn = new mysqli($servername, $username, $password); // no dbname yet
$sql = "CREATE DATABASE myDB";
if ($conn->query($sql) === TRUE) {
    echo "Database created successfully";
}

검증 상태 및 신뢰도

  • 상태: draft
  • 검증 단계: conceptual
  • 출처 신뢰도: B (W3Schools — widely used educational reference, not a primary standards body)
  • 신뢰 점수: 0.89
  • 중복 검사 결과: 신규 생성 (New discovery)

🔗 지식 그래프 (Knowledge Graph)

📚 출처 (Sources)

📝 변경 이력 (Change history)

  • 2026-07-04: Initial draft synthesized from the W3Schools "PHP Create a MySQL Database" page (Astra wiki-curation, P-Reinforce v3.1 format).