Plesk Automation :: Set User And Privileges From Mysql
Jul 3, 2014
I'd want to create a user and set custom privileges using the standard mysql-client, ie. create user and grant privileges, but I know that sometimes Plesk overwrites my config files for other services.
I need a MySQL user that has the privileges to add routines and triggers. The default users that are created by Plesk do not have these rights. How would I be able to add these rights to a specific user, or all users, that doesn't care.
I already logged in over SSH as a root user:
Code: mysql -uadmin -p`cat /etc/psa/.psa.shadow`
Then I tried to update the rights of the users:
Code: mysql >UPDATE db SET Create_view_priv = 'Y', Show_view_priv = 'Y', Create_routine_priv = 'Y', Alter_routine_priv = 'Y'; mysql> FLUSH PRIVILEGES; Query OK, 0 rows affected (0.00 sec)
This didn't work. So I wanted to add super privileges by doing this:
Code: mysql> GRANT SUPER ON *.* TO 'user'@'%' IDENTIFIED BY 'mypassword'; Query OK, 0 rows affected (0.00 sec) mysql> FLUSH PRIVILEGES; Query OK, 0 rows affected (0.00 sec)
when I find the subscription from the admin side of PPA, if I select "Login as user" I've noticed that it is different from actually logging in as the user - for example - "add domain alias" is missing when I login as a customer - but not as an admin... I need my customers to add their own aliases and manage them - how do I add that feature to the client login side?
I believe the product we are using is Parallels Operations Automation.
We have a customer that we want to be able to give the right to unlock user accounts. The only way to do this seems to be to enable "Billing" as one of the privileges. Unfortunately this gives them more access than we really want to. Is there some trick we can use to give this user only these rights?
Is it possible to disable the option to change the system user (FTP/SSH) for customers. I can disable this for the control panel user but not the system user (FTP/SSH). Is there any option to do this that I didn't see?
On a cPanel server, running RHEL 4 I got the following error (from cpanel logs) while associating an user with a DB from the cPanel admin:
Fri Apr 11 17:02:47 2008 info [Cpanel::Mysql]: Not updating privileges for user (reseller login and no password specified in ~/.my.cnf) at /usr/local/cpanel/Cpanel/Mysql.pm line 268 Cpanel::Mysql::updateprivs('Cpanel::Mysql=HASH(0xa4a8768)') called at /usr/local/cpanel/bin/mysqladmin line 88 Fri Apr 11 17:02:47 2008 info [Cpanel::Mysql]: Not updating privileges for user (reseller login and no password specified in ~/.my.cnf) at /usr/local/cpanel/Cpanel/Mysql.pm line 268
In fact, from cPanel interface all privileges are added OK, but the MySQL itself is not connecting at all due to this error.
I log in as Reseller1 (clean login; not by switching from PPA Admin to Reseller1), create a Webspace and a Database. At that point I am able to see and create Databases on every Node, even on Reseller1 (Node1), which is set to restricted. I guess this behaviour is not intended, isn't it?
What could I fix by trying to start mysql server, recieve following errors:
Code: Failed to restart the "mysql" service. Cannot start/stop/restart service: Rather than invoking init scripts through /etc/init.d, use the service(8) utility, e.g. service mysql restart Since the script you are attempting to invoke has been converted to an Upstart job, you may also use the stop(8) and then start(8) utilities, e.g. stop mysql ; start mysql. The restart(8) utility is also available. start: Job failed to start
from the console:
Code: sudo service mysql start start: Job failed to start
Code: mysql -uadmin -p`cat /etc/psa/.psa.shadow` psa ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) output of plesk_11.5.30_reset_instance_data.log:
I'm trying to set permission for text file which is exists in Program Files (x86)MyFile directory. File should be accessible by psaadm and not accessible for psacln accounts. I've set permissions for psaadm Full Control Allow and for psacln Full Control Deny.
In my PHP script I'm checking file using is_readable function and no matter which user trying to read this file function always returns true (admin or customer account). I tried to find solution in Web but without success so I'd like to ask you about it.
Additionally, I've tried to create Plesk DiskSecurity XML with privileges settings. After Apply this settings privileges are correctly set for my file, but customers still can read this file.
Is there any other way to deny access to this file for customers and resellers?
I recently upgraded the Plesk to 11.5.30. Now I am not able to create new MySQL databases. I am getting below error.
Code: Error: Connection to the database server has failed because the supplied account does not possess administrative privileges: Access denied for user 'admin'@'localhost' (using password: YES)
MySQL admin details are correct in plesk database, also the admin has full privileges. I am manually able to create databases, users from mysql prompt. It's just the plesk interface that's giving error.
Code: C:Program Files (x86)ParallelsPleskMySQLbin>mysql -u admin -p*************** mysql Welcome to the MySQL monitor. Commands end with ; or g. Your MySQL connection id is 68 Server version: 5.1.68-community MySQL Community Server (GPL)
I am using cPanel 11 (stable release) on a CentOS 5 server and would like to make it so that a certain database can only be connected to from the cPanel user that it is under (ie. user1_db can only be connected to from the user "user1" on the same server).
Does anyone know what could be the cause of this issue? I located a few others over at cpanel.net that have this problem, but no solution has been found.
I am running a VPS server with the following:
WHM 10.8.0 cPanel 10.9.1-S14304 RedHat 9 i686 - WHM X v3.1.0 phpMyAdmin - 22.214.171.124 MySQL client version: 4.1.10 mysql version: 5.0.27-standard
I have a database user that needs "Super Privileges" and so this was done. However, when Cpanel is updated the user permission is reset automatically from "ALL PRIVILEGES" to "USAGE".
Here's a look at the database permissions from phpMyAdmin.
Code: User Host Password Global privileges Grant hello localhost Yes ALL PRIVILEGES Yes hello_ % No ALL PRIVILEGES Yes hello_ localhost No ALL PRIVILEGES Yes
The user "hello" loses its "ALL PRIVILEGES" and switches over to "USAGE" if an update is triggered. Updates to cpanel, creating/removing a database/user, and updating the account password will cause the switch.
I am trying to start mysql but i am getting the following error
MySQL manager or server PID file could not be found! [FAILED] Starting MySQL................................... [FAILED]
I checked my hostname.err file in /var/lib/mysql and this is the error message it shows.
070130 17:59:41 mysqld started 070130 17:59:42 [ERROR] /usr/sbin/mysqld: Table './mysql/user' is marked as crashed and should be repaired 070130 17:59:42 [ERROR] /usr/sbin/mysqld: Table './mysql/user' is marked as crashed and should be repaired 070130 17:59:42 [ERROR] Fatal error: Can't open and lock privilege tables: Table './mysql/user' is marked as crashed and should be repaired 070130 17:59:42 mysqld ended
how I would repair that to get mysql to start again?