I have installed and created local MySQL test databases and tables on my Windows 7 PC. In order to connect to the database in Java, I need the parameters of the DriverManager getConnection API which includes the username and password and the URL to the database.
Itâs the exact same information you used when you connected to set up those databases: some username, maybe a password, and the âURLâ is the hostname (which was probably âlocalhostâ).
You might have been using the root user at the time, and you should create user account(s) so you donât have to use the all-powerful root all the time, but for a start that will be fine.
Each application should have itâs own MySQL account which itâll use to access MySQL, that acount should only have access to the applicationâs own database and shouldnât have any more permissions then what it needs to operate. Each applicationâs password should be a strong one and each application should have a different password.
For your âsuper-userâ (one that can edit anything and everything in any database) that you use to edit the structures of your databases, it shouldnât be root, once youâve created a new âsuper-userâ account root should be deleted. Donât call the âsuper-userâ account anything obvious like Admin as thatâll be one of the first usernames that a hacker would probably try. The âsuper-userâ's password should be a strong one and different from all the accounts used by the applications.