Ubuntu: How to create a new database in MySQL

Last updated on

Firstly, you must log in as root.

mysql -u root -p

Now you can create a new database. Replace your_dbname with the name of your database.

CREATE DATABASE your_dbname;

You may want ot grant privileges to this database.

GRANT ALL PRIVILEGES ON your_dbname.* To 'your_username'@'localhost' IDENTIFIED BY 'your_password';

Once you have finalised the permissions, always be sure to reload all the privileges.

FLUSH PRIVILEGES;

Let me know if this helped. Follow me on Twitter, Facebook and YouTube, or 🍊 buy me a smoothie.

p.s. I increased my AdSense revenue by 200% using AI 🤖. Read my Ezoic review to find out how.

Leave a reply

Your email address will not be published.