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

  • Review Aplikasi Barcode No Thanks
  • Cukur Kumis Viral di TikTok: Link Video 3 Menit 56 Detik Diserbu Netizen, Awas Link Bahaya!
  • Belinesia: Peluang Emas atau Jebakan Penipuan? Bongkar Fakta & Cara Aman Gabung!
  • Inilah Bahaya Aplikasi Auto Followers: Jebakan NCSE yang Harus Kalian Waspadai!
  • Apakah MLM Meta Force Indonesia itu Aman, Legal, atau Penipuan?
  • Apakah Zalora Community Influencer Program itu? Penipuan atau Tidak?
  • Apakah Ocean of Games Legal/Resmi & Bebas Virus?
  • Bahaya Hacking Dibalik No WA Duda Mapan Cari Jodoh Istri Pengusaha Kaya Raya yang Serius
  • Apa arti Kota Penerbit Identitas di Bank BNI?
  • Apakah Bank Saqu Astra Aman atau Penipuan?
  • Apakah Platform Amalan.id Penipu?
  • Apa itu Rekening Pasif di Bank BRI? Apa Resikonya?
  • Apa Arti Kode ‘Bunga Rekening’ di Mutasi Rekening Bank BRI?
  • Apa itu BRI Nex Card? Keuntungan, Fitur, dan Cara Daftarnya
  • Cara Mudah Membuat Rate Card dengan AI Tahun 2026
  • Cara Memperbaiki Glance Error di OnePlus 13
  • Apakah Langkah Open-source dari X Ancam Akun Anonim?
  • Kenapa Hewan Tidak Punya Klorofil?
  • Apa itu Kegiatan Review dan Pengertian Review
  • Bulgaria Lumpuhkan Situs Pembajakan Streaming & Game, AS Ikut Campur!
  • Apa itu Google Analytics 4?
  • Cara Cek Status DTSEN Terbaru, DTSEN Jadi Penentu Bansos PKH & BPNT 2026
  • Nvidia GeForce Now Resmi di Linux!
  • Kode Redeem Blade Ball Roblox Terbaru 1 Februari 2026: Raih Hadiah Spesialmu!
  • Kode Paket Internet Indosat Murah Terbaru 2026: Kuota 25GB Cuma 50 Ribu?
  • AFK Fishing Roblox: Auto Panen Ikan 24 Jam Pakai CC Cloud Phone!
  • Rahasia Meta AI WhatsApp: Cara Ampuh Dapat Cuan dari Chatbot!
  • Gokil! Case Pixel Diskon 90% di Verizon, Buruan Sikat!
  • Apakah APK CashCepat Penipu? Ada Izin Pinjol OJK?
  • Lowongan Kerja Leader di BRI Melalui BFLP Specialist 2026, Cek Syarat Lengkapnya Di Sini!
  • What are Microsoft Copilot Reminders?
  • What’s New in Plasma 6.7? Quick Notification History Clear-Up!
  • Awesome Alternatives to Microsoft Defender Application Guard (MDAG)
  • How tto Enable DLSS 4 & 5 for Your GPU
  • Backlinks: Why They’re Super Important for Your Website!
  • 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 Morning Star Kursi Gaming/Kantor disini: https://s.shopee.co.id/805iTUOPRV
Beli Pemotong Rumput dengan Baterai IRONHOOF 588V Mesin Potong Rumput 88V disini https://s.shopee.co.id/70DBGTHtuJ

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