Archive for the tag 'database'

Restoring a User’s Database Access For WHM version 11.36

If a database user loses access to databases, you may be able to restore the user’s grants to the database using the restoregrants utility.

Using Restoregrants to Restore the User’s Database Access

Execute one of the following commands from the command line:

/usr/local/cpanel/bin/restoregrants –cpuser=$cpuser –db={mysql, pg} –dbuser=$dbuser
or
/usr/local/cpanel/bin/restoregrants –cpuser=$cpuser –db={mysql, pg} –all

$cpuser The cPanel username which has lost access to databases.
{mysql, pg} The type of database: mysql for MySQL or pg for PostgreSQL.
$dbuser The database user whose privileges you wish to restore.

mysqlshow - display database, table, and column information

SYNOPSIS

mysqlshow [options] [db_name [tbl_name [col_name]]]

DESCRIPTION
The mysqlshow client can be used to quickly see which databases exist, their tables, or a table´s columns or indexes.

mysqlshow provides a command-line interface to several SQL SHOW statements.
The same information can be obtained by using those statements directly.

For example, you can issue them from the mysql client program.

Invoke mysqlshow like this:

shell> mysqlshow [options] [db_name [tbl_name [col_name]]]

If no database is given, a list of database names is shown.
If no table is given, all matching tables in the database are shown.

Plesk - how do I enable remote access to MySQL database server?

Sometimes you need to provide the remote access.

Open /etc/my.cnf and make sure that the following lines exists/commented in [mysqld] section:

[mysqld]
port = 3306
bind-address = 10.10.0.1
# skip-networking

Restart MySQL. Now you should grant access to remote IP address, login to Mysql:

# mysql -uadmin -p`cat /etc/psa/.psa.shadow` mysql

For example if you want to allow access to database called ‘foo’ for user ‘bar’ and remote IP 192.168.0.1 then you need to type following commands at “mysql>” prompt:

mysql> GRANT ALL ON foo.* TO bar@’192.168.0.1′ IDENTIFIED BY ‘PASSWORD’;
mysql> REVOKE GRANT OPTION ON foo.* FROM bar@’192.168.0.1′;

Reference: http://kb.parallels.com/

AIDE - Build, Store, and Test Database

Generate a new database:

# /usr/sbin/aide –init

By default, the database will be written to the file /var/lib/aide/aide.db.new.gz.

The database, as well as the configuration file /etc/aide.conf and the binary /usr/sbin/aide (or hashes of these files) should be copied and stored in a secure location. Storing these copies or hashes on read-only media may provide further confidence that they will not be altered.

Install the newly-generated database:

# cp /var/lib/aide/aide.db.new.gz /var/lib/aide/aide.db.gz

Run a manual check:

# /usr/sbin/aide –check

If this check produces any unexpected output, investigate.

SBDavid

Cpanel Database Soft Quotas

Cpanel Database Soft Quotas

The file used to cache the number of databases owned by an account moved from /home/user/.cpanel/datastore/mysql-db-count to /var/cpanel/datastore/user/mysql-db-count. Likewise the PostgreSQL cache file is now /var/cpanel/datastore/user/postgres-db-count.

To keep the cache file current, a cron job executes the following command periodically: /scripts/update_db_cache.

cPanel™ 11.25 provides support for including the disk space consumed by an account’s MySQL and PostgreSQL database in the disk usage for the account. To enable this feature toggle the following Tweak Settings:  When displaying disk usage in cPanel/WHM include Postgresql and MySQL® disk usage.

Next »