LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   setting password for mysql user in startup (https://www.linuxquestions.org/questions/linux-software-2/setting-password-for-mysql-user-in-startup-4175528720/)

sumeet inani 12-18-2014 10:39 PM

setting password for mysql user in startup
 
Hi ,
I am using mysql in linux .

Code:

$ mysql --version
mysql  Ver 14.14 Distrib 5.5.17, for Linux (i686) using  EditLine wrapper

I have added following line in startup script

Code:

        sudo mysqladmin -u root password root123
Still when I try to run a jar file , I get
Quote:

$ java -jar OAAS_LCT_2.17Patch.jar
client socket created :: Ready to communicate with OLT Server
NE Type received from OLT SERVER: OFFICEDAM
flag.flagProject false
Unable to connect to the database createConnectionForDb
CGPONJdbcConnect.createinitTables()
jdbcConnect.query()create database GponLct
CGPONJdbcConnect.createinitTables()java.lang.NullPointerException
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoa der.java:58)
Caused by: java.lang.NullPointerException
at com.org.cdot.gpon.lct.general.Application.CGPONJdbcConnect.createinit Tables(CGPONJdbcConnect.java:71)
at com.org.cdot.gpon.lct.general.Application.CGPONJdbcConnect.createCmDB (CGPONJdbcConnect.java:99)
at com.org.cdot.gpon.lct.general.Application.CGPONJdbcConnect.createDB(C GPONJdbcConnect.java:226)
at com.org.cdot.gpon.lct.general.Application.CGPONCentralInterface.Intia liseLCT(CGPONCentralInterface.java:231)
at com.org.cdot.gpon.lct.general.GUI.GGenOltProject.<init>(GGenOltProjec t.java:132)
at com.org.cdot.gpon.lct.general.GUI.GGenOltProject.main(GGenOltProject. java:143)
... 5 more
Now after I run startup command manually in terminal , then jar file works .

Any ideas ?

astrogeek 12-18-2014 11:07 PM

None of that makes any sense, actually...

Are you referring to the mysql start script where you are setting the password?

Why would you set a root user password from the startup script?
And why would you think that would enable a client to connect to a database server?

Why would you think that had anything to do with running a jar file?
What connection parameters are set for the connection and how does the java program use them?

These are not rhetorical questions, perhaps your application instructs you to do this, but it is very strange.

Also, what distro, what java application, what does the application documentation say is required for the db connection?

Much more information would elp.

sumeet inani 12-22-2014 12:14 AM

i am using tiny core 4.7.7
i have installed mysql.tcz
Code:

~$ java -version
java version "1.7.0_03"
Java(TM) SE Runtime Environment (build 1.7.0_03-b04)
Java HotSpot(TM) Server VM (build 22.1-b02, mixed mode)

my jar file wants that user root should have password root123 then it can access database gponlct
I even added following script in startup to check if my sql is running then set password
Code:

#!/usr/local/bin/bash
if pgrep mysqld
then
        echo mysql running > /home/tc/mysql-log
        sudo mysqladmin -u root password root123
        echo root password for mysql set to root123 > /home/tc/mysql-log
else
        echo mysql-not-running > /home/tc/mysql-log
fi

I got /home/tc/mysql-log with
'mysql running
root password for mysql set to root123'

But password has to be set again in terminal , like before .

sumeet inani 12-29-2014 09:59 PM

even created file .my.cnf
Code:

[client]
user=root
password=root123

[mysql]
user=root
password=root123

[mysqldump]
user=root
password=root123

[mysqldiff]
user=root
password=root123

in /root & /home/tc

The problem persists .

sumeet inani 12-29-2014 10:18 PM

trying http://dev.mysql.com/doc/refman/5.1/...ion-files.html


All times are GMT -5. The time now is 06:36 AM.