How are you logging in? There are two ways that should log you in automatically from DirectAdmin (one is located under "MySQL Management" and one is under "Extra Features".
If you want to use mySQL in a script, you would need to create the database and a user for it from within DirectAdmin (also under MySQL Management).