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

  • Lagi Rame Botol Golda Viral 19 Detik? APA ITU? Jangan Asal Klik Link Sembarangan, Ini Bahayanya!
  • Apa itu Regedit FF Auto Headshot 100 No Password 2024? Simak Definisi dan Cara Kerjanya
  • Apa Itu KPH dan MPH? Pengertian dan Perbedaannya di Game Balap
  • Belum Tahu? Inilah Cara Aman Quotex Login dan Solusi Kalau Error!
  • Apa Itu Fitur Gestur Baru di Pixel Watch 4? Ini Pengertian dan Perbedaannya
  • Belum Tahu? Inilah Cara Aman Login Binomo dan Trik Trading Buat Pemula Biar Nggak Boncos
  • Cara Mengatasi Error ‘Versi Diagnostik Belum Terbarui’ (Your current version of diagnostics is not up to date)
  • Cara Membuat Newsletter di Outlook 365
  • Sering Telepon di Tempat Berisik? Fitur Baru Expressive Call dari Google Bakal Jadi Penyelamat Kalian!
  • Google Pixel 10 Pro Akan Punya Integrasi Play Points Lebih Dalam
  • Stop Cara Kuno! Ini Trik Supaya Manajemen Karyawan Jadi Lebih Cepat dan Anti Ribet
  • Bug di Aplikasi Cuaca Wear OS Google: Update Tidak Ngaruh!
  • Samsung Kembangkan Sensor Kamera Baru Pakai Teknologi Global Shutter dan Efek Blur Bergerak
  • Cara Membuat Anggaran Otomatis di Excel
  • Baseus X1 Pro Kamera: Kamera Ringkas dengan Fitur Canggih dan Harga yang Menarik
  • Profil Sosmed Kalian Sepi? Gini Caranya Makeover Bio Biar Makin Dilirik Sama Netizen!
  • Cara Mengatasi Error ‘Disk is Full or Read-Only’
  • Belum Tahu? Inilah Trik Ampuh Atasi Error ‘We Were Unable To Create Your Notebook’ di OneNote
  • Trik Instagram Stories 2025: Ubah Viewer Jadi Loyal Follower dengan Fitur Sederhana Ini
  • Turning TikTok into a Money-Making Machine
  • Cara Ekstrak Driver Intel RST/VMD dari setuprst.exe: Panduan Lengkap
  • Pixel 8 dan 8 Pro Akan Punya Kamera Baru Resolusi 10.2MP, Hasil Lebih Baik di Kondisi Redup
  • Inilah Trik Website Kalian Lolos Core Web Vitals dan Ranking Naik
  • YouTube TV Uji Coba Fitur Tonton Rekaman Pertandingan Olahraga NFL,NBA, MLB Terbatas
  • Aawi Wireless Dua Habis Stok, Model Android Auto Tunggal Masih Diskon
  • Samsung Akan Luncurkan One UI 8.5 dengan Inspirasi ‘Liquid Glass’ yang Memukau
  • XBox Game Pass PC Tidak Bisa Address GPU ke Game
  • Your Pocket-Sized Doctors: 3 Health Apps Changing the Game on Android and iOS
  • Waymo Bawa Teknologi ‘Liquid Glass’ untuk Mobil Otonom
  • Rumor Google Akan Update UI Besar-besaran Desember 2025
  • Ini Dia ESP32 P4: IoT RISC-V dengan Layar AMOLED dan LoRa, Perangkat Handheld Inovatif
  • Apa Itu HealthyPi-6? Solusi Open Source untuk Akuisisi Biosignal
  • Jetson THOR Industrial PC: 25Gbe Networking dan Bisa Pakai Kamera GMSL2
  • Azul Systems Akuisisi Payara Java Server
  • PC Kentang Jadi Ngebut? Coba GRML 2025, Distro Debian Ringan dengan Kernel 6.17!
  • Apa Itu US National Framework for AI? Kepres Donald Trump Bikin Heboh Dunia AI
  • Kenapa Bisnis Properti & Real Estate Harus Pakai AI, Ini Alasannya!
  • BARU! Brave Browser Bakal Bisa Ngerjain Tugas Kalian Secara Otomatis Lewat Agentic AI!
  • Belum Tahu? Google Maps Bakal Makin Canggih Berkat Integrasi Gemini Visual Ini!
  • Siap-Siap! Tahun 2026 Gemini Bakal “Menjajah” Chrome, iPhone, sampai Smartwatch Kalian
  • Apa itu Data Breach Coupang? Pengertian dan Kronologi Kebocoran Data Terbesar di Korea Selatan
  • Apa Itu CVE-2018-4063? Pengertian Celah Keamanan Sierra Wireless AirLink yang Masuk Katalog CISA
  • Apa Itu Ashen Lepus? Kelompok Peretas yang Mengincar Instansi Pemerintah Timur Tengah
  • Pengertian Vulnerability WebKit Apple Terbaru: Apa Itu CVE-2025-43529 dan CVE-2025-14174?
  • Apa Itu Fake OSINT? Definisi dan Bahaya Repositori GitHub Palsu

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