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

    30th September 2022
  • Automated MySQL Installation

    Automated MySQL Installation

    14th April 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 6th October 2022
  • How To Install & Configure a Galera Cluster with MariaDB on Centos 7 6th February 2018
  • Allow a cPanel server to run a VHOST from multiple IP addresses 3rd April 2018
  • rsync without prompting for password 10th October 2022

Recent Posts

  • Understanding Why More Threads Can Sometimes Slow Down Performance 9th October 2024
  • Set up a new systemd service 18th May 2024
  • Bash Arrays 7th November 2023
  • rsync without prompting for password 10th October 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