MySQL

Connecting to database

MySQL, like all client-server DBMSs, requires that you log in to the DBMS before being able to issue commands. MySQL maintains a list of users internally, and associates rights with each.

When you first installed MySQL, you were probably prompted for an administrative login (often named root) and a password. If you are using your own local server and are simply experimenting with MySQL, using root login is fine. In the real world you should not use this root login as access to it grants full rights to create tables, drop entire databases, change logins and passwords.

Using MySQL Administrator The MySQL Administrator Users view provides a simple interface that can be used to define new users, including assigning passwords and access rights.

To connect to MySQL you need the following:

  • The hostname (the name of the computer), for a local MySQL server, this is localhost

  • The port, the default port is 3306

  • A valid user name and password

As explained in previous pages all of this information can be passed to the mysql command-line utility, or entered into the server connection screen in MySQL Administrator and MySQL Query Browser. If you are using any other client you still need to provide this information in order to connect to MySQL. After a successful login you have access to whatever databases and tables your login name has access to.

by BrainBellupdated
Advertisement: