How To Create a MySQL Database in cPanel

  1. This tutorial assumes you’ve already logged in to cPanel, and are starting on the home screen.
  2. Now let’s learn how to create a MySQL database.
  3. Click the "MySQL Databases" icon.

    cpanel-pl-mysql-2-createdb-02

  4. Enter a name for the new database, then click "Create Database".

    cpanel-pl-mysql-2-createdb-03

  5. That’s it! A new MySQL database has been created.

    cpanel-pl-mysql-2-createdb-04

  6. The new database is listed on the databases page, under "Current Databases".

    cpanel-pl-mysql-2-createdb-05

 

How To Set up a Database using the MySQL Database Wizard in cPanel

  1. This tutorial assumes you’ve already logged in to cPanel, and are starting on the home screen.
  2. Now let’s learn how to setup a database using the MySQL Database Wizard. Click the "MySQL Database Wizard" icon.

    cpanel-pl-mysql-1-wizard-02

  3. Enter a name for the new database, then click "Next Step".

    cpanel-pl-mysql-1-wizard-03

  4. Now we have to create a user for this database. Enter a username and create a password, then click "Create User".

    cpanel-pl-mysql-1-wizard-04

  5. Click the "All Privileges" check box, then click "Next Step".

    cpanel-pl-mysql-1-wizard-05

  6. That’s it! My MySQL database has been created, and the new user added to the database. The database name, username and password will all be needed for scripts that need to connect to the database.

    cpanel-pl-mysql-1-wizard-06

  7. Now click the MySQL Databases icon on the main page.

    cpanel-pl-mysql-1-wizard-07

  8. Here you can see the new database you just setup.

    cpanel-pl-mysql-1-wizard-08

 

How To Create a MySQL Database in cPanel

  1. This tutorial assumes you’ve already logged in to cPanel, and are starting on the home screen. Now let’s learn how to create a MySQL database.

    cpanel-paperlantern-25-mysql--01

  2. Click the "MySQL Database Wizard" icon.

    cpanel-paperlantern-25-mysql--02

  3. Enter a name for the new database, then click "Next Step".

    cpanel-paperlantern-25-mysql--03

  4. Now we have to create a user for this database. Enter a username and create a password, then click "Create User".

    cpanel-paperlantern-25-mysql--04

  5. Click the "All Privileges" check box, then click "Next Step".

    cpanel-paperlantern-25-mysql--05

  6. That’s it! My MySQL database has been created, and the new user added to the database. The database name, username and password will all be needed for scripts that need to connect to the database.

    cpanel-paperlantern-25-mysql--06

 

How To Retrieve or Reset the Root MySQL Password

If the root MySQL password is required and can’t be located, it can be retrieved or reset.

Pre-Flight Check

Step #1: Recovering the Root MySQL Password on a cPanel server

On servers running cPanel, the root MySQL credentials are stored locally in a file that only the root user can access. After you’ve connected to the server as root via SSH, you can view the credentials by running the following command:

cat /root/.my.cnf

That should output a result containing the MySQL password, which will appear similar to the following:

[root@host ~]# cat /root/.my.cnf
[client]
password=AVeryStrongPassword
user=root

Make a note of the current password.

Step #2: Resetting the Root MySQL Password

If you need to reset the root MySQL password and have access to WebHost Manager on a cPanel server, you can do so by selecting MySQL Root Password from WHM’s menu. If you don’t have access to WHM, you still can change the password via CLI after stopping and restarting MySQL in single-user mode.

Caution: While the MySQL server is running in single-user mode, any user can access any database without a password. You will want to work quickly, so please read through these instructions to ensure you fully understand the process before proceeding. You also may wish to temporarily configure your firewall to block external traffic to the MySQL port (3306).
  1. Stop MySQL:

    service mysql stop

  2. Start MySQL in single-user mode, bypassing password authorization, by pasting in the command below (the ampersand is required):

    mysqld_safe --skip-grant-tables &

  3. Now type “mysql” to connect:

    mysql

  4. At the mysql prompt, change the root password using the following three commands:

    UPDATE mysql.user SET password=password("YourNewStrongPassword") WHERE user='root';
    FLUSH PRIVILEGES;
    exit;

  5. Now stop MySQL and start it in normal mode:

    service mysql stop
    service mysql start

  6. Verify that you are able to connect to MySQL by entering “mysql”.
  7. Finally, update the MySQL root password in /etc/.my.cnf to match the new value. You can use vi, vim or nano:

    vim /root/.my.cnf

    In vim, you can press “a” or “i” to enter text insertion mode; pressing the escape key (Esc) on your keyboard returns you to command mode. For a refresher on editing files with vim, see New User Tutorial: Overview of the Vim Text Editor.

 

How To Install MySQL/MariaDB on Fedora 23

MariaDB is a drop-in replacement for MySQL. It is easy to install, offers many speed and performance improvements, and is easily integrated into most MySQL deployments. MariaDB offers more storage engines than MySQL, including Cassandra (NoSQL), XtraDB (drop-in replacement for InnoDB), and OQGRAPH.

Pre-Flight Check

  • These instructions are intended for installing MariaDB on a single Fedora 23 node.
  • We’ll be working as root on a Liquid Web Self Managed Fedora 23 server.
  • If you have any questions about compatibility, you can find answers at: MariaDB versus MySQL – Compatibility.

Step #1: Install MariaDB

As always, we’ll first ensure that our existing packages are up to date:

dnf -y update

MariaDB can be installed with one command:

dnf -y install mysql-server mysql

Step #2: Start MySQL/MariaDB

Start MySQL (now MariaDB) with the following command:

systemctl start mariadb

To ensure that MySQL/MariaDB starts at boot, run the following command:

systemctl enable mariadb

That should produce output similar to the following:

[root@host ~]# systemctl enable mariadb
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.

You can check the status of MySQL/MariaDB with:

systemctl status mariadb

Step #3: Using MySQL/MariaDB

You connect to MySQL/MariaDB with the following command:

mysql

That should produce output similar to the following:

[root@host ~]# mysql
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 5
Server version: 10.0.21-MariaDB MariaDB Server
Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

To exit and return to your command prompt, simply execute the following command:

exit
 

Error: Login without a password is forbidden by configuration (see AllowNoPassword) [SOLVED]

This error relates to logging into phpMyAdmin, an open source tool used for the administration of MySQL.

Once in awhile, perhaps on a Development server, MySQL won’t be setup with a root password. The aforementioned configuration is generally thought of as against best practices however, if it is what you’re dealing with, then it could also interfere with phpMyAdmin.

Pre-Flight Check

  • These instructions are intended specifically for solving the error: Login without a password is forbidden by configuration (see AllowNoPassword).
  • I’ll be working from a Liquid Web Self Managed Ubuntu 15.04 server, and I’ll be logged in as root.

The Error

The error will read “Login without a password is forbidden by configuration (see AllowNoPassword)” as shown below.

Error Login without a password is forbidden by configuration (see AllowNoPassword) [SOLVED]

Continue reading “Error: Login without a password is forbidden by configuration (see AllowNoPassword) [SOLVED]”

How to Install and Configure phpMyAdmin on Ubuntu 15.04

phpMyAdmin is an open source tool used for the administration of MySQL. In addition to offering the capability to perform administration tasks such as creating, editing, or deleting databases, and managing users and permissions, phpMyAdmin provides a graphical user interface to do all of these tasks and more.

Pre-Flight Check

  • These instructions are intended specifically for installing phpMyAdmin on Ubuntu 15.04.
  • I’ll be working from a Liquid Web Self Managed Ubuntu 15.04 server, and I’ll be logged in as root.
  • A LAMP, Linux, Apache, MySQL and PHP, must be installed on your server.

Continue reading “How to Install and Configure phpMyAdmin on Ubuntu 15.04”

How to Install and Configure phpMyAdmin on Fedora 22

phpMyAdmin is an open source tool used for the administration of MySQL. In addition to offering the capability to perform administration tasks such as creating, editing, or deleting databases, and managing users and permissions, phpMyAdmin provides a graphical user interface to do all of these tasks and more.

Pre-Flight Check

  • These instructions are intended specifically for installing phpMyAdmin on Fedora 22.
  • I’ll be working from a Liquid Web Self Managed Fedora 22 server, and I’ll be logged in as root.
  • A LAMP stack, meaning Linux, Apache, MySQL and PHP, must be installed on your server.

Continue reading “How to Install and Configure phpMyAdmin on Fedora 22”

How To Install MySQL / MariaDB on Fedora 22

MariaDB is a drop-in replacement for MySQL. It is easy to install, offers many speed and performance improvements, and is easy to integrate into most MySQL deployments. Answers for compatibility questions can be found at: MariaDB versus MySQL – Compatibility. MariaDB offers more storage engines than MySQL, including Cassandra (NoSQL), XtraDB (drop-in replacement for InnoDB), and OQGRAPH.

Pre-Flight Check

  • These instructions are intended for installing MariaDB on a single Fedora 22 node.
  • I’ll be working from a Liquid Web Self Managed Fedora 22 server, and I’ll be logged in as root.

Continue reading “How To Install MySQL / MariaDB on Fedora 22”