Javamelody with Tomcat and MySql - mysql

I have setup a web application in Tomcat with Javamelody and MySql. I am able to see the JDBC connection details under system info so I know that Javamelody is able to connect to the database. I have executed select/update statements from my application but nothing is ever shown on the monitoring page under statistics sql. I have executed "show full processlist" using the same user as my database connection and it works fine. I can't work out what I am doing wrong.
Any ideas?

Don't mess monitoring tool into problem.
You can check if connection works without it.
(E.g. create table and insert some data and then check if table exists).

Related

AWS MySQL Database Disappearing

I have a MySQL database running on AWS RDS. I have a node.js server that queries the MySQL database. Everything is fine for most days but around once a week, my node server says "Unknown database."
I try to query the database with MySQL Workbench and receive the same message. I have checked my instance and it is running fine with the status being "available."
To fix the issue, I have to recreate the database which means I lose all my data.
Has anyone had issues with this? This is very frustrating since I have no idea what would cause this problem.
We‘re running MySQL RDS databases since AWS launch and never had such an issue. Are you sure the created database is really gone? Do you maybe have a job running at an interval that doesn’t work as intended? What do the RDS logs say?
To debug the issue you can
have a look at RDS server logs
enable query logging to table and analyze queries fired at the server
run a small instance which is not touched for the period to proof it’s not a RDS-related isssue
A few years later...lol. I had the same problem and realised you have to be connected to the same domain in AWS as your database. If you know the connection string of your database, find the domain it is in. Then in the top right hand side of the aws console you should see a drop down that shows the current domain you are logged into. My guess is the two are not the same. Change the value of the drop down and you should see your database.

How to Update Mysql database on live server with my local mysql database

Please I need help, I have an application running well on the Internet but the Network go down drastically sometimes,
So I imported the online database to my offline version. I want to be running the offline version and update the live version on regular basis either automatically with php code or through phpmyadmin. Please anyone with an idea of how I can do that should please help.
Thanks
You can update the local database automatically when the live server gets a chance.
This concept calls database replication(Master Slave Model).
You can slave your local database which doesn't need static IP. You can set it anywhere.
Master Database need must need static IP. And you can connect as many slaves as you want with the master database.
The Master database automatically sent changes to all slaves.

TeamCity won't create its schema in SQL Server

I've installed a new TeamCity instance and just moved from internal storage to database (SQL Server). Followed the instructions at http://confluence.jetbrains.com/display/TCD7/Setting+up+an+External+Database and I know I've done the database part correctly as it wouldn't initially connect and I had to go back and turn on TCP/IP connections for SQL Server.
From the documentation I assumed that team city would create and maintain it's own database schema, but even though it's user is dbo the database remains blank - no tables, views or any other objects have been created.
When I try to connect to it in a browser I get "Database is empty or doesn't exist", and viewing the logs shows me "Schema contains no tables". I've obviously restarted the service and connected again each time.
Is there an install script I am missing? How do I get TeamCity to install it's schema?
When you are doing it like this, you will need to migrate the initial structure over to sql server. See here

mysql queries run as root

My situation is like this:
I have two servers, one is a windows server running IIS and holds my web site.
The other is a linux server that holds my mysql server.
I created a (mysql) user on the mysql server with a minimum set of privileges, and I use its credentials when connecting from my website to run queries.
But when I run a query, and check the processes that are running on the mysql server (mysql> show processlist), I see that the query I executes (from the web site) is being run under the (mysql) root account!
Any idea why this should happen??
Hituptony got it :-)
My query was processed by a SP, and turned into a prepared statement and then run...
That SP was defined with the root account (god knows why), and more ever didn't have the "invoker" security clause.
http://dev.mysql.com/doc/refman/5.5/en/stored-programs-security.html
I guess it would depend on what you are doing, if you are running a stored procedure and it is created by a root account, then when you run it it will still show the "user who created" it as the one running it, when in reality it is probably the connection user. In theory if you are running a select statement you would therein be running as the connection user, as there would be no "creator" to the select...if you catch my driftage...

phpMyAdmin crashing the MySQL host server

I have encountered this problem a couple of times, in the last few days. So, it happens occasionally. I have setup mysql on a remote machine, and there is a java program on another machine querying the database to read and write records every few seconds.
I am using phpMyAdmin to administer my database. And, at times, after running some SQL query, the mysql server stops responding. Even the pinging the host machine doesn't succeed. And, I have to ask someone with physical access to the machine to boot it up again.
I checked for log files but couldn't find them in the mysql directory. Is logging disabled by default? What is missing here? And, how can I go about troubleshooting this?
EDIT:
I was able to ping the server after some while. So, the server must have been temporarily busy. It's not a specific query but things like re-ordering the data of a table serially under the browse tab.
Use a mysqlclient to make a connection and keep it open.
I personally use the mysql from the commandline.
If the server becomes unresponsive execute
SHOW PROCESSLIST;
It will list all mysql processes and will show how long queries are waiting/executing.
Optionally use the KILL statement to terminate the query that locking the tables.
KILL $pid
I'd highly recommend using MySQL's own GUI tools for database management, for a vriety of reasons:
They have full support for InnoDB tables, including Foreign Key management
You can use database-level security to make sure only you get into your data (unlike phpMyAdmin, which at best can only be root access installed behind a .htaccess password)
It is official and supported. No extra binaries run on the server, so you run no risk of it crashing and taking the server down with it (unless your query itself is locking it...)