Mysql – create new MySQL database and user using OS root credentials

MySQL

I have root permissions on a server (running Redhat):

[root@myserver /]# 

… but not on the MySQL instance that's running on the server:

[root@myserver /]# mysql -u root   
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

I'd like to create a new database on the MySQL instance (version 5.6.26), and an account with GRANT ALL PRIVILEGES ... on the new database.

Is this possible (e.g. using mysqladmin) using only the OS root account?

Best Answer

I believe you will need to install another, separate instance of MySQL, configure it to run on a different port, specify that port in your login screen, and then do as you like.

You can do this by simply installing MySQL to another disk location, and then editing the ini file. On Windows and Mac installations, this is called my.ini

Alternatively, I think your only choice is to get permissions granted to you on the currently installed MySQL instance. The root password to the OS and the root password to the MySQL server instance are entirely distinct (as I'm sure you know).