The Lazy Admin Blog

Home  /  MySQL  /  Create MySQL database & user from cli

Create MySQL database & user from cli

April 14, 2016 MySQL Leave a Comment

The following script creates a MySQL database & a user who will be assigned as a privileged user to the db.

We used the following credentials for this example –

Database name: mysite_db
Database user: mysite_user
Database password: mypassword

## create db & user
mysql -u root -e "create database mysite_db DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;"
mysql -u root -e "grant all privileges on mysite_db.* to mysite_user IDENTIFIED BY 'mypassword' ;"
Tags: MySQL
Previous Article
Next Article

Related Posts

  • InnoDB: Failed to find tablespace for table `X` in the cache

    InnoDB: Failed to find tablespace for table `X` in the cache

    September 30, 2022
  • Automated MySQL Installation

    Automated MySQL Installation

    April 14, 2016

Leave a Reply

Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Search Our Blog

Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors
Filter by Categories
Apache
CentOS
CloudLinux
cPanel
Emails
ESXI
iSCSI
JetBackup
Linux
Litespeed
MySQL
NGINX
Oracle
Reduxio
Security
SSL
Uncategorized
VMware
Wordpress
XEN

Tags

apache aspx backup bash CentOS cloudlinux cPanel CXS Emails freetds google htaccess IMAP InnoDB iscsi JetBackup Libmodsecurity litespeed modsec modsecurity mssql MySQL netapp nginx odbc Oracle php php.ini phpselector rsync ssh ssmtp systemd threads VMFS WHM Wordpress xenserver

Popular Posts

  • Convert JetBackup to cPanel structure October 6, 2022
  • How To Install & Configure a Galera Cluster with MariaDB on Centos 7 February 6, 2018
  • Allow a cPanel server to run a VHOST from multiple IP addresses April 3, 2018
  • rsync without prompting for password October 10, 2022

Recent Posts

  • Understanding Why More Threads Can Sometimes Slow Down Performance October 9, 2024
  • Set up a new systemd service May 18, 2024
  • Bash Arrays November 7, 2023
  • rsync without prompting for password October 10, 2022

Recent Comments

  • Sven on rsync without prompting for password
  • TheLazyAdmin on rsync without prompting for password
  • Sven on rsync without prompting for password
  • TheLazyAdmin on Convert JetBackup to cPanel structure
  • Chris on Convert JetBackup to cPanel structure
Privacy Policy • Contact