I am trying to write a PHP/Shell command that creates a database on a WHM/cPanel server. Here is what I have tried:
- Accessed SSH through Putty
- Connected to mysql server using
create database cpaneluser_newdatabase;
Access denied for user 'cpanel_username'@'localhost' to database
Access denied for user 'cpanel_username'@'localhost' to database 'cpaneluser_newdatabase'
means User: cpanel_username , accessed at localhost ,has no privileges to access database cpaneluser_newdatabase;
try to login the mysql with root, and grant privileges to ;
grant all on cpaneluser_newdatabase.* to cpanel_username@'localhost'
cpanel_username@'localhost' is very strange....
better use the mysqlclient like this:
mysql -u<username> -p