How to install mysql on linux avoiding Access denied for user ‘root’@'localhost’

First Download the MySql sever and Client. Download the correct Linux Operating system and Machine Architecture.

  1. MySQL-server-5.6.11-2.linux_glibc2.5.x86_64.rpm
  2. MySQL-client-5.6.11-2.linux_glibc2.5.x86_64.rpm

Then install the server and then the client.

  1. rpm -ivh MySQL-server-5.6.11-2.linux_glibc2.5.x86_64.rpm
  2. rpm -ivh MySQL-client-5.6.11-2.linux_glibc2.5.x86_64.rpm

After successfully installing both. Check the file in this location /root/.mysql_secret. This file contains the mysql root password which is randomly generated.

Afterwords start the mysql server using below command.

  • /etc/init.d/mysql start

Then type mysql -u root or mysql and try to connect.

If it provides below errors.

  • ERROR 1045 (28000): Access denied for user ‘root’@'localhost’ (using password: YES)
  • Access denied for user ‘root’@'localhost’ (using password: NO)

Solution is to open vi /etc/my.cnf and then insert the following to the file and save. After words you will be able to connect to mysql.

[client]
user=”root”
pass=”XXXXXXXX”

 

crontab -e     Edit your crontab file, or create one if it doesn’t exist.
crontab -l      Display your crontab file.
crontab -r      Remove your crontab file.
00   05   *   *    *  cd /home/tharinduj/app/test; echo $PATH; sh start.sh
 -        -       -    -    -
|        |       |     |     |     |       |
|        |       |     |     |     |       +—-Name of the executable file (sh file)
|        |       |     |     |     +—–Location of the directory holds the executable file
|        |       |     |     +—– day of week (0 – 6) (Sunday=0)
|        |       |     +——- month (1 – 12)
|        |     +——— day of month (1 – 31)
|        +———– hour (0 – 23)
+————- min (0 – 59)
  • Start cron service
    • /etc/init.d/crond start
  • Stop cron service
    • /etc/init.d/crond stop
  • Restart cron service
    • /etc/init.d/crond restart
To start the job after a reboot.
@reboot sh /home/tharinduj/app/test/start.sh

JVM -X options

JVM option Meaning
-Xms Initial java heap size
-Xmx Maximum java heap size
-Xmn The size of the heap for the new objects created which has a shoreter life span, GC will happen frequently

Permanent Space : This has the third part of the memory. Here are stored classes, methods, pre compliled JSP.
-XX:PermSize: initial value
-XX:MaxPermSize: max value

XML error: cvc-elt.1: Cannot find the declaration of element

XMLValidator.XMLErrorHandler : XML error: cvc-elt.1: Cannot find the declaration of element

This error occurs when you try to validate the xml with your schema or dtd. You are simply missing few thing in your code and XML files.

Your Code

File configFile = new File(configFileName);

DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();

dbf.setNamespaceAware(true);//Add this if its not in your code

DocumentBuilder db = dbf.newDocumentBuilder();

Document doc = db.parse(configFile );

doc.getDocumentElement().normalize();

boolean isValidSchema = XmlParser.validateXmlSchema(doc, Constants.PATH_MSG_CONFIG_SCHEMA, Constants.DEFAULT_SCHEMA_LANG);

Your XSD

<?xml version=”1.0″ encoding=”ISO-8859-1″ ?>
<xs:schema xmlns:xs=”http://www.w3.org/2001/XMLSchema” elementFormDefault=”qualified&#8221; xmlns=”urn:nonstandard:OBJ” targetNamespace=”urn:nonstandard:OBJ”>
<xs:element name=”Object”>

……

 </xs:element>

</xs:schema>

Your XML

<?xml version=”1.0″ encoding=”UTF-8″ standalone=”no”?>

………………..

 

Local XARecoveryModule.xaRecovery got XA exception XAException.XAER_RMERR: javax.transaction.xa.XAException

WARN [com.arjuna.ats.jta] ARJUNA-16027 Local XARecoveryModule.xaRecovery got XA exception XAException.XAER_RMERR: javax.transaction.xa.XAException
at oracle.jdbc.xa.OracleXAResource.recover(OracleXAResource.java:709) [:11.2.0.2.0]

If this error is encountered while your J2EE application is deployed in JBoss6, you will have to provide following grants to your db user as sys user.

grant select on sys.dba_pending_transactions to <USER_NAME>;
grant select on sys.pending_trans$ to <USER_NAME>;
grant select on sys.dba_2pc_pending to <USER_NAME>;
grant execute on sys.dbms_system to <USER_NAME>;

Invalid invocation, check your deployment packaging

javax.ejb.EJBException: Invalid invocation, check your deployment packaging, method=public abstract a.b.c.XFacade a.b.c.XFacadeHome.create() throws javax.ejb.CreateException,java.rmi.RemoteException

I have EAR and WAR file and WAR is calling Ejbs in the EAR. The both get deployed properly and when trying to use functionality it provides above error. To avoid this callByValue and java2ClassLoadingCompliance has to be enabled in Jboss6 config files.


edit <JBOSS_HOME>\server\default\deployers\ear-deployer-jboss-beans.xml

  • <property name=”callByValue”>true</property> 

edit <JBOSS_HOME>\server\default\deployers\jbossweb.deployer\META-INF\war-deployers-jboss-beans.xml

  • <property name=”java2ClassLoadingCompliance”>true</property>

Cannot find any provider supporting RSA/NONE/NoPadding

exception: java.security.NoSuchAlgorithmException: Cannot find any provider supporting RSA/NONE/NoPadding

If you ever see this exception. In my case I am using org.bouncycastle.jce.provider.BouncyCastleProvider as my security provider. I need to add the relevant java version specific BouncyCastleProvider jars to  <JAVA_HOME>\jre\lib\ext folder as the first thing. Since I was using JDK 1.6 I had to download the java 1.5 or higher supported jars to above mentioned folder.

  • bcpg-jdk15on-147.jar
  • bcprov-ext-jdk15on-147.jar

Then I need to add the new security provider to java.security file in this folder, <JAVA_HOME>\jre\lib\security

  • edit java.security file.
  • Add the following line to the list of existing security providers

          security.provider.10=org.bouncycastle.jce.provider.BouncyCastleProvider

  •  save the file.