How to get MySQL root Password in Linux Plesk?




Plesk MySQL server have no root user. Instead Plesk have user “admin” with root privileges.

You can run the command given below to get MySQL admin user password.

[root@server ~] # cat /etc/psa/.psa.shadow
3G5wVCxDGotP4itJ


Verify the password by login to the admin user.

[root@server ~] # mysql -u admin -p3G5wVCxDGotP4itJ
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1234 to server version: 5.1

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql>




If you want login to MySQL without entering the password always, go through the following steps.

Create a file, /root/.my.cnf and add the follwong contents in it.


[mysql]
user = admin
password = 3G5wVCxDGotP4itJ

[mysqldump]
user = admin
password = 3G5wVCxDGotP4itJ


This will allow you to use mysql and mysqldump without providing passwords.



Install/Enable DKIM and SPF in a cPanel Account


DKIM and SPF


Emails not getting delivered to inbox of yahoo, hotmail and gmail is a common problem that many users face due to different reasons, many times its IP reputation or the email activity on the shared environment. spf and domainkeys can help with this situation to get the emails delivered directly to inbox.

DomainKeys: An email authentication method that attempts to verify that a message actually came from the domain it appears to have come from.

SPF (Sender Policy Framework): A feature that allows a recipient server to verify that an email message has really been sent from the domain specified in the From: field. Enabling SPF can prevent your server from receiving replies to spam that has forged your domain name as part of the sender’s address. SPF only works if both the sending and receiving mail servers have SPF enabled.

Installation:


The following script will allow to enable spf and DKIM for a single cpanel account.

# /usr/local/cpanel/bin/dkim_keys_install  <CPANELUSER>
# /usr/local/cpanel/bin/spf_installer  <CPANELUSER>

If you want to enable spf and DKIM to all the accounts in the server, you have to run the following script.

===========================================================
 for user in `ls -A /var/cpanel/users` ; do

    /usr/local/cpanel/bin/dkim_keys_install $user  &&

    /usr/local/cpanel/bin/spf_installer $user ; done

===========================================================

To set up the server to automatically create an SPF record and DomainKey for new accounts, edit/create /scripts/postwwwacct and paste in the following code:
postwwwacct is a file which execute after wwwacct (used to create account).

===========================================================
#!/usr/bin/perl

my %OPTS = @ARGV;

$ENV{USER} = “$OPTS{‘user’}”;
system q(/usr/local/cpanel/bin/dkim_keys_installer $USER);
system q(/usr/local/cpanel/bin/spf_installer $USER);

============================================================

After that give executable permission to the script.

# chmod 755 /scripts/postwwwacct


Verification:


Give your domain name in the field $domain and issue the following commands.

# dig +short default._domainkey.$domain TXT

The above commmand will show the DKIM result.

# dig +short $domain TXT

The above command will give the spf result.


You can also verify DKIM and SPF by sending mails.

Send an email from the domain to check-auth@verifier.port25.com. You will get an autoresponse back letting you now that everything is working.
You will get summary as like following if everything is working.

===============================
Summary of Results
===============================
SPF check:                     pass
DomainKeys check:        neutral
DKIM check:                   pass
Sender-ID check:            pass
SpamAssassin check:     ham


Reference:
http://www.openspf.org/SPF_Record_Syntax

How to add a new Wordpress Admininstrator user using phpMyAdmin?




You can create a new database administrator user in wordpress sites using phpMyadmin by issuing the following three Database Queries.

After running these queries, you can login to your worpress admin with the following login details.
UserName: admin1
Password: admin1


Query1:

INSERT INTO `databasename`.`wp_users` (`ID`, `user_login`, `user_pass`, `user_nicename`, `user_email`, `user_url`, `user_registered`, `user_activation_key`, `user_status`, `display_name`)
VALUES ('4', 'admin1', MD5('admin1'), 'Admin', 'admin@yourdomain.com', 'http://www.yourdomain.com/', '2012-12-30 00:00:00', '', '0', 'Admin');

Query2:

INSERT INTO `databasename`.`wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`)
VALUES (NULL, '4', 'wp_capabilities', 'a:1:{s:13:"administrator";b:1;}');

Query3:

INSERT INTO `databasename`.`wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`)
VALUES (NULL, '4', 'wp_user_level', '10');


Note:- Please don't forget to change the 'databasename' with the database you are working with.
Please read through all the fields in the tables and change the values as you wish.

Reference:
http://www.wpbeginner.com/wp-tutorials/how-to-add-an-admin-user-to-the-wordpress-database-via-mysql/

cPanel - edquota: Quota file not found or has wrong format.


Error:

After running /scripts/fixquotas it gives the following error message and showing unlimited disk space in
WHM >> Main >> List accounts.

==============================================================
edquota: Quota file not found or has wrong format.
No filesystems with quota detected.
==============================================================

Solution:

The error is due to no quota file. You can follow the steps shown below to fix this issue.

root@server [~]# touch /home/quota.user
root@server [~]# touch /home/quota.group
root@server [~]# chmod 600 /home/quota.user
root@server [~]# chmod 600 /home/quota.group
root@server [~]# quotacheck -acugvm

quotacheck: Scanning /dev/simfs [/] quotacheck: Cannot stat old user quota file: No such file or directory
quotacheck: Cannot stat old group quota file: No such file or directory
quotacheck: Cannot stat old user quota file: No such file or directory
quotacheck: Cannot stat old group quota file: No such file or directory
done
quotacheck: Checked 16689 directories and 234323 files
quotacheck: Old file not found.
quotacheck: Old file not found.

root@server [~]# /scripts/fixquotas --force

Installing Default Quota Databases......Done
Quota Mode: Linux
journaled quota support: not available with vzaquota (disabled)
Quotas have been enabled, however they may not be up to date as quotacheck has been skipped.
Reading package Starter
Resetting quota for arun to 2000 M
.
..
...

Thanks...

Microsoft JET Database Engine error '80004005'


Error:

The following error typically occurs when your script attempts to perform an UPDATE or some other action that alters the information in the database.

===========================================================================================
Microsoft JET Database Engine error '80004005'

The Microsoft Jet database engine cannot open the file 'C:\Inetpub\vhost\YourSite\Databases\YourDatabase.mdb'.
It is already opened exclusively by another user, or you need permission to view its data.

/YourSite/YourDataAccessPage.asp, line 15
=============================================================================================


Solution:

The above error occurs because ADO(ActiveX Data Objects) is unable to write to the Microsoft Access database due to insufficient write/modify permissions, which can be easily fixed by granting read/write to IUSR_<machineName> and IWAM_<machineName>.

IUSR_<machineName> and IWAM_<machineName> come into focus when an anonymous web user needs to modify the Microsoft Access database & while doing so Jet creates an .ldb file to handle database locking. If the above mentioned 2 users don't have the necessary permissions, the lock file isn't created & ultimately the Microsoft Access database can't be modified.

To fix this problem,

1. Make sure that the MDB file itself isn't marked as read-only.
2. Right click the folder in which the *.mdb files belongs and choose the properties option and select the Security tab. Give read/write permissions to IUSR_<machineName> and IWAM_<machineName> users. If there is no such users listed in it, add those users for that folder.



Note:-
There is also an alternate solution for this issue. You can find a user called 'everyone', add this user for the folder in which *.mdb belongs and give read/write permissions. But this is not good because of security reasons.

Reference:

http://imar.spaanjaars.com/263/how-do-i-fix-asp-80004005-errors

WebAdmin link for MSSQL database shows 404 page not found


Error:

WebAdmin link for a Plesk user's MSSQL database shows 404 page not found.

Login To Plesk >> Databases >> WebAdmin show below error(Redirects to URL below):

==================================================================================================
Server Error in '/' Application.
The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable.  Please review the following URL and make sure that it is spelled correctly.

Requested URL: /mssql/app/connect.aspx

WebAdmin link for their MSSQL database shows 404 page not found.
==================================================================================================


Solution:

1. Firstly try to ping the sub-domain mssql.mydomain.com and check if it is working or not, if not, you need to create a dns entry for mssql. If the same error still persists, you can run the following commands in the 'cmd'.

2. Run the commands one by one in 'cmd'

   > cd %plesk_bin%

   > websrvmng.exe --reconfigure-sqladmin
   > defpackagemng.exe --fix --type=sqladminmssql

Error in Detach a database in the MSSQL Management Studio


Error:

When you try to Detach a database in the MSSQL Management Studio, you may seen the following error.
When this issue happend to me, there is no issues in creating, deleting, detaching database. There is problem only in the Detaching option.

-----------------------------------------------------------------------------------------------------------------------------------------------------
C:\Program files(x86)\Parallels\Plesk\Databases\MSSQL\MSSQL.1\MSSQL\Data
Cannot access the specified path or file on the server. Verify that you have the necessary security privileges and that the path or file exists.

If you know that the service account can access a specific file, type in the full path for the file in the File Name control in the Locate dialog box.
-----------------------------------------------------------------------------------------------------------------------------------------------------

Solution:

1. Run services.msc to view all the Services in the server.

2. Find the service named "SQL Server(MSSQLSERVER 2008)".
    Check the "Log On As" column of that service, whether it is 'Local System' or 'Network System'.
    If it is 'Network System', you have to change to 'Local System', which will fix your issue. The following screenshots will give you to change it.


3. Right Click on the particular service and select 'Properties' option.


4. Select 'Log On' tab and select the option,
       Log On As:
       Local System Account
       Click on Allow service to interact with Desktop
   Then click option OK.


5. You have to restart the service to make changes in effect.
     Select General tab. You Stop and Start the service in there.
     Then click option OK.



Thanks...