Margo
Margo

Reputation: 368

View contents of MySQL database

I've got a working Java web application that has been created a long time ago by other person, and is pretty abandoned by its creator already for couple years, but has active users uploading/downloading pdf files to it.

I now need to access the database to look at its structure, so that I can migrate some files and user data in future to use in a new project being built now.

I don't have much knowledge of Java web applications and MySql, but I have access to the server where all the project files are located. There is a persistence.xml file with the url of that database and username/password in it.

How do I actually view the contents of the database?

Upvotes: 1

Views: 18073

Answers (3)

user404
user404

Reputation: 2028

I don't know how much this will help, but at least will help you to explore more. You can try:
Login to your remote server[using any client]

  • open terminal
  • type: mysql -u root -p
  • provide password when prompted
  • run: show databases [check if there is multiple database and identify which-one you need to work with]
  • run: use your_database_name
  • run: show tables;
  • now run or check table entries however you like to check like describe table-name , select queries or anyway you prefer.

Update: Alternative and easy one:
You can use datagrip. Just add your data source and credentials and then click on your database. Super user friendly I have ever seen.

Upvotes: 4

Dimsquid
Dimsquid

Reputation: 540

What you need to look for in the persistence.xml is a url, type that URL into your browser or a database viewer I'm on mac and use SEQUELPRO, you should be greeted with a login box, if you use the credentials that you found within that file then you should be able to view everything.

it should look something like this

<property name=”javax.persistence.jdbc.url” value=”jdbc:mysql://localhost:3306/jpadb”/> <property name=”javax.persistence.jdbc.user” value=”root”/> <property name=”javax.persistence.jdbc.password” value=”password”/> <property name=”javax.persistence.jdbc.driver” value=”com.mysql.jdbc.Driver”/>

Source: itnext.io

If you could include the persistence.xml without the credentials that would be helpful.

Upvotes: 2

Heavy Driller
Heavy Driller

Reputation: 21

You need a client that connects to your database like Toad or SQL Developer. If you have the credentials and connectivity addresses this should be easy..

Upvotes: 2

Related Questions