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 Cara Login EMIS 4.0 Kemenag dan Cek Syarat PPG Biar Nggak Ketinggalan Info!
  • iPhone Fold Bakal Ngegas! Baterai Terbesar Sepanjang Masa, Katanya Bocoran!
  • Goshare WhatsApp Penghasil Uang: Aman atau Penipuan? Fakta & Cara Kerjanya!
  • Samsung Galaxy S26 Ultra Bocor: Hanya Hitam dan Putih? S-Pen Juga Ikut Jadi Sorotan!
  • Sok Imut Cukur Kumis Viral di TikTok: Link Aman atau Jebakan?
  • Apakah Website Credinex: Legal atau Ilegal?
  • Cara Mengatasi Error: “Kenapa Situs Ini Tidak Dapat Dijangkau”
  • Day 1 Cukur Kumis Viral: 356 Menit Link di X dan Telegram Langsung Disorot Netizen
  • Beli HP di Shopee Aman Nggak Sih?
  • Apa itu Android Desktop Camera dari Google?
  • Notepad++ Diduga Disusupi Hacker State-sponsored!
  • Fitur Baru di Apple TV Februari 2026
  • Bilibili Legal Gak Sih? Yuk, Kupas Tuntas Soal Nonton Anime di Sana!
  • Bisakah Bayar QRIS Pakai GoPayLater?
  • Apakah Aplikasi Amar Bank Tunaiku: Legal, Penipu atau Tidak?
  • Apa itu Mac Configurator?
  • Kenapa No Token Gagal Terus? Begini Cara Memasukkan!
  • Kode Bank Terbaru 2026: Kenali Arti dan Fungsinya! Jangan Sampai Salah Transfer
  • Bahayanya ‘Kumpulan Grup Asupan Malam Hijab Lokal Bocil Indo’, Waspada Phising!
  • Kenapa Voucher Axis Gagal Terus? Ini Dia Penyebab & Cara Mengatasinya!
  • Kenapa Meta AI Nggak Muncul di WhatsApp Padahal Udah Update?
  • Cara Mengatasi Error SofaScore: Panduan Lengkap & Anti Ribet!
  • Asuransi Mobil Zurich Indonesia: Penipu atau Tidak? Bongkar Faktanya!
  • Apakah Web Sribu.com Penipuan untuk Freelancer atau Tidak?
  • Cara Menonaktifkan SpayLater & Spinjam: Panduan Lengkap & Anti Ribet!
  • Panik Lupa Passcode iPhone? Jangan Reset! Ini Cara Ampuhnya
  • Printer Ngambyuk! Cara Ampuh Atasi Error 709 di Windows 11
  • Apakah Koin Shopee Bisa Buat Bayar Shopee PayLater?
  • Strategi Lolos PTN: Bongkar Tuntas Pembobotan UTBK Berdasarkan Jurusan!
  • Apa itu Meta AI WhatsApp Business?
  • Linux News Roundup February 2026
  • How to Install JellyFin Media Server on Samsung TV with TizenOS
  • Why OneNote Clears Your Notes
  • AMD NPU Monitoring on Linux: A Beginner’s Guide to AI Chip Tracking!
  • How to Fix AMD Adrenalin’s Game Detection Issues on Windows
  • Cara Membuat Podcast dari PDF dengan NotebookLlama dan Groq
  • Tutorial Membuat Sistem Automatic Content Recognition (ACR) untuk Deteksi Logo
  • Apa itu Google Code Wiki?
  • Cara Membuat Agen AI Otomatis untuk Laporan ESG dengan Python dan LangChain
  • Cara Membuat Pipeline RAG dengan Framework AutoRAG
  • 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