Thursday, December 8, 2016

Manipulating SQL Data

Manipulating SQL Data


After installing your MySQL packages, you next need to set up your
MySQL server’s granttables. All MySQL access controls are managed from within the MySQL
service itself. It’s important to understand that MySQL has its own unique set of user accounts
defined in its grant tables; it doesn’t use the accounts defined on your Linux system. Five tables
are implemented within the MySQL database to do this:


user

Specifies whether a user is allowed to connect to the MySQL server


db

Defines which databases a user is allowed to access


host

Specifies which hosts are allowed to access a particular database


tables_priv

Defines access privileges for a given table


columns_priv

Specifies access privileges for specific columns of data for a given table




These tables must be initialized before you can use MySQL. This is
done by changing to the

/usr/bin directory

and running the

mysql_install_db

command at the shell prompt.


With the grant tables created, you next need to start the database
service.

If your distribution uses init, you can use the mysql init script located in your init
script directory. Then you can use the insserv or chkconfig

command to ensure the database service starts
every time the system

boots. If your distribution uses systemd, you can use the systemctl
command to enable and start the mysql service.

To verify that the server is running, you can enter the

mysqladmin version

command at the shell prompt.


you can view the databases currently on the server by entering

mysqlshow

 at the command prompt.


You can also view the tables within any of the databases shown in the
output using the

mysqlshow table_name

 command.


Now that MySQL is running properly, you need to assign passwords to
your MySQL user accounts.

After you run msql_install_db, your root database user account has been created but has no password assigned. To remedy this, enter


mysqladmin –u root password  ‘your_new_password'



 at the shell prompt. Then restrict root access to the system where MySQL is running

by entering


mysqladmin –u root –h system_hostname password  mysql_root_user_password


at the shell prompt.


LX0-104 Exam Objectives (G)

No comments:

Post a Comment