Introduction to MySQL
Basic MySQL administration tools
Usually only the root user has permission to create new databases and new users for the MySQL server. The MySQL user is independent of any other username. This means that an individual may use more than one MySQL username. To enter the MySQL interface as root: unixprompt> mysql -u root -p
Enter password: mysql>
1.2.1 Create a MySQL database
It is easy to create a new MySQL table within the MySQL prompt.
mysql> CREATE DATABASE tissueinfo;
1.2.2 Users, passwords, and privileges
We now have an empty database, but we don’t yet have any users to access this database. To simultaneously create a user, assign a password, and grant access to this newly created database enter:
mysql> GRANT USAGE ON tissueinfo.* to wbyeats@localhost IDENTIFIED BY ’ode2maud’;
This creates the user “wbyeats” if it doesn’t already exist, and sets the password to “ode2maud”. Note that if the user “wbyeats” already exists the password will be set to “ode2maud” (even if the password was previously set to something different). This statement also grants wbyeats access to all of the tables within the tissueinfo database (specified by “tissueinfo.*”).
One of the attractive features of MySQL is the strict security it gives your data. The tradeoff is some extra work for the database administrator, because access privileges must be individually set. Granting usage only allows the user to log in to the database, but not to actually look at the data or enter any data.
To grant these privileges the root user must also specify:
mysql> GRANT SELECT, INSERT ON tissueinfo.* to wbyeats@localhost IDENTIFIED BY ’ode2maud’;
Which gives “wbyeats” permission to look at data (SELECT) and to add new data (INSERT). If you trust “wbyeats” you can grant all possible permissions (including permission to delete any data in the database) with the simple statement:
Related Tags: empty database, mysql administration, data select, attractive features, strict security

Leave a Reply