Hi everyone, I’m having an issue after deploy app. I’m using Tomcat8 and MySQL, everithing is running ok. I reach the app deployed from web browser and if I test database conection from console is running too: root@pgi:~# mysqladmin -u root -p status Enter password: Uptime: 51967 Threads: 1 Questions: 45 Slow queries: 0 Opens: 115 Flush tables: 1 Open tables: 34 Queries per second avg: 0.000
The problem is when I try to query the database from app, I can’t login. I can’t reach the db from app-.
this is the spring conf conection file:
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
<property name="url" value="jdbc:mysql://localhost:3306/xxxxx_db" />
<property name="username" value="test" />
<property name="password" value="xxxxxxxxxxx" />
is there some extra config in this scenario? Thanks!
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
When creating a user from the CLI, you should use something such as:
create database dbname;
grant all on dbname.* to 'dbuser'@'localhost' identified by 'dbpass';
That should allow a successful connection to the database dbname using the user dbuser and the password dbpass (of course you should sub in your own details).
From looking at their documentation, you shouldn’t need the port 3306 attached since you’re using localhost. If you were connecting remotely, then you would specify a port. When connecting locally, it shouldn’t be needed.
So we’d change this:
<property name="url" value="jdbc:mysql://localhost:3306/xxxxx_db" />
To:
<property name="url" value="jdbc:mysql://localhost/xxxxx_db" />
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.