Page 25 - Open Soource Technologies 304.indd
P. 25

Open Source Technologies



                   Notes         These tables will become more important to you later in this unit as you add a few sample
                                 users to My SQL. For now, just remember that these tables exist and must have relevant data in
                                 them in order for users to complete actions. Further discussed in working with user privileges.

                                 The Two-Step Authentication Process
                                 As you’ve learned, My SQL checks three things during the authentication process. The actions
                                 associated with these three things are performed in two steps:
                                    1.  My SQL looks at the host you are connecting from and the username and password pair
                                      that you are using. If your host is allowed to connect, your password is correct for your
                                      username, and the username matches one assigned to the host, My SQL moves to the
                                      second step.
                                    2.  For whichever SQL command you are attempting to use, My SQL verifies that you have
                                      the ability to perform that action for that database, table, and field.
                                 If step 1 fails, you’ll see an error about it and you won’t be able to continue on to step 2. For
                                 example, suppose you are connecting to My SQL with a username of joe and a password of
                                 abc123 and you want to access a database called myDB. You will receive an error message if
                                 any of those connection variables is incorrect for any of the following reasons:
                                 Your password is incorrect.

                                 Username joe doesn’t exist.
                                 User joe can’t connect from localhost.

                                 User joe can connect from localhost but cannot use the myDB database.
                                 You may see an error like the following:
                                 #/usr/local/My SQL/bin/My SQL -h localhost -u joe -pabc123 test

                                 Error 1045: Access denied for user: ‘joe@localhost’ (Using password: YES)
                                 If user joe with a password of abc123 is allowed to connect from localhost to the myDB database,
                                 My SQL will check the actions that joe can perform in step 2 of the process. For our purposes,
                                 suppose that joe is allowed to select data but is not allowed to insert data. The sequence of
                                 events and errors would look like the following:
                                 #/usr/local/My SQL/bin/My SQL -h localhost -u joe -pabc123 test

                                 Reading table information for completion of table and column names
                                 You can turn off this feature to get a quicker startup with -A
                                 Welcome to the My SQL monitor. Commands end with ; or \g.

                                 Your My SQL connection id is 61198 to server version: 4.0.21-log
                                 Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.
                                 My SQL> select * from test_table;

                                 +——+——————+
                                 | id | test_field |

                                 +——+——————+
                                 +——+——————+




        20                                LOVELY PROFESSIONAL UNIVERSITY
   20   21   22   23   24   25   26   27   28   29   30