Skip to content

emka.web.id

menulis pengetahuan – merekam peradaban

Menu
  • Home
  • Tutorial
  • Search
Menu

MySQL: Setting Up a MySQL User Account

Posted on August 17, 2012

Problem
I need to create an account to use for connecting to the MySQL server running on a given host.

Solution
Use the GRANT statement to set up the MySQL user account. Then use the account’s name and password to make connections to the server.

Discussion
Connecting to a MySQL server requires a username and password. You can also specify the name of the host on which the server is running. If you don’t specify connection parameters explicitly, mysql assumes default values. For example, if you specify no hostname, mysql typically assumes that the server is running on the local host.

If someone else has set you up with an account, just use that account to create and use databases. If not, the following example shows how to use the mysql program to connect to the server and issue a GRANT statement that sets up a user account with privileges for accessing a database named cookbook. In the commands shown, the % represents the prompt displayed by your shell or command interpreter, and mysql> is the prompt displayed by mysql. Text that you type is shown in bold. Nonbold text (including the prompts) is program output; you do not type it. The arguments to mysql include -h localhost to connect to the MySQL server running on the local host, -p to tell mysql to prompt for a password, and -u root to connect as the MySQL root user.

[sourcecode]% mysql -h localhost -p -u root
Enter password: ******
mysql> GRANT ALL ON cookbook.* TO ‘cbuser’@’localhost’ IDENTIFIED BY ‘cbpass’;
Query OK, 0 rows affected (0.09 sec)
mysql> QUIT
Bye
[/sourcecode]

Terbaru

  • Inilah Estimasi Waktu Pencairan TPG 2026 Sehabis SKTP Muncul di Info GTK
  • Cara Menggunakan openClaw untuk Kebutuhan SEO
  • Apakah Tunjangan Profesi Guru Hangus Karena SKTP Belum Terbit?
  • Cara Tarik Saldo PNM Digi ke Rekening & Daftar: Panduan Lengkap & Terbaru!
  • Apa itu Penipuan Michat Hotel?
  • Yang Baru di Claude 5 Sonnet
  • Tip Jadi Kreator di Pinterest Tahun 2026
  • Cara Jualan Produk Digital Tanpa Harus Capek Promosi Terus-Menerus
  • Rangkuman Strategi Bisnis Baru dari CEO Youtube 2026, Wajib Dibaca Kreator Nih
  • Apa itu Platform WeVerse? Ini Penjelasan Lengkapnya
  • Inilah Cara Mendapatkan 1000 Subscriber Cuma dalam 3 Hari Tanpa Edit Video Sama Sekali
  • Apa itu Shibal Annyeong yang Viral TikTok?
  • Apakah iPhone Inter Aman?
  • Kenapa Gemini AI Bisa Error Saat Membuat Gambar? Ini Penjelasannya!
  • Daftar Akun Moonton via Web Tanpa Aplikasi untuk MLBB
  • Cara Hapus Akun Terabox: Panduan Lengkap dan Aman
  • Khaby Lame’s $957M Digital Identity Deal Explained
  • Cek HP Anak, Apakah Ada Video Viral Cukur Kumis Bawah
  • Jika ATM Terpelanting, Apakah Saldo Aman?
  • Inilah 5 Rekomendasi Smartwatch Terbaik di Bawah Rp1 Jutaan
  • Siapa Daud Tony yang Ramal Jatuhnya Saham & Harga Emas-Perak?
  • Berapa Cuan Dari 1.000 Tayangan Reels Facebook Pro?
  • Apakah Jika Ganti Baterai HP, Data akan Hilang?
  • Apa itu Game Sakura School Simulator Solwa?
  • Hasil Benchmark Xiaomi Pad 8 Global Bocor! Siap-siap Masuk Indonesia Nih
  • KAGET! Ressa Rizky Rossano Akui Sudah Nikah & Punya Anak
  • Inilah Kronologi Ledakan Bom Rakitan SMPN 3 Sungai Raya, Kubu Raya Kalbar
  • Cara Mengatasi Error 208 BCA Mobile
  • Hapus Sekarang! Inilah Hornet, App LGBTQ Tembus Indonesia, Hati-hati
  • Berapa Lama Sih Ngecas HP 33 Watt? Ini Dia Penjelasannya!
  • Calibre 9.2 Released: New ZIP Output and Features for E-Book Lovers
  • Raspberry Pi 4 Rev 1.5 Dual RAM Explained for Beginners
  • Darktable 5.4.1 Released: Major Bug Fixes and New Features
  • GNU Linux vs Just Linux: What’s the Difference Explained
  • How to Add Shared Mailbox in Outlook
  • Cara Ubah Role Definition Menjadi Custom Instructions yang Efektif buat Claude Project
  • Cara Mendefinisikan Role Project Claude Agar Hasilnya Lebih Akurat dan Konsisten
  • Cara Buat AI Asisten Pribadi dengan Teknik RAG
  • Cara Membuat Podcast dari PDF dengan NotebookLlama dan Groq
  • Tutorial Membuat Sistem Automatic Content Recognition (ACR) untuk Deteksi Logo
  • Apa itu Spear-Phishing via npm? Ini Pengertian dan Cara Kerjanya yang Makin Licin
  • Apa Itu Predator Spyware? Ini Pengertian dan Kontroversi Penghapusan Sanksinya
  • Mengenal Apa itu TONESHELL: Backdoor Berbahaya dari Kelompok Mustang Panda
  • Siapa itu Kelompok Hacker Silver Fox?
  • Apa itu CVE-2025-52691 SmarterMail? Celah Keamanan Paling Berbahaya Tahun 2025
Beli Pemotong Rumput dengan Baterai IRONHOOF 588V Mesin Potong Rumput 88V disini https://s.shopee.co.id/70DBGTHtuJ
Beli Morning Star Kursi Gaming/Kantor disini: https://s.shopee.co.id/805iTUOPRV

©2026 emka.web.id | Design: Newspaperly WordPress Theme