MySQL separate user accounts: Difference between revisions

Jump to navigation Jump to search
no edit summary
mNo edit summary
No edit summary
Line 1: Line 1:
=[http://ybyfonojot.co.cc Under Construction! Please Visit Reserve Page. Page Will Be Available Shortly]=
{{Uc nav mysql}}
{{Uc nav mysql}}
'''Hosting separate user accounts on MySQL server'''
'''Hosting separate user accounts on MySQL server'''
Line 52: Line 53:
'''Create databases:'''
'''Create databases:'''


<ol start="4">
&lt;ol start=&quot;4&quot;&gt;
<li> Enter new database name into '''Create new database''' field and click on '''Create'''
&lt;li&gt; Enter new database name into '''Create new database''' field and click on '''Create'''
<li> '''Click on Home''' takes you back to the home page.
&lt;li&gt; '''Click on Home''' takes you back to the home page.
<li> Repeat steps 4 and 5 for each new database that requires creating
&lt;li&gt; Repeat steps 4 and 5 for each new database that requires creating
</ol>
&lt;/ol&gt;


'''Create user accounts:'''
'''Create user accounts:'''


<ol start="7">
&lt;ol start=&quot;7&quot;&gt;
<li> Click on '''Home''' (Start page)
&lt;li&gt; Click on '''Home''' (Start page)
<li> Click on '''Privileges''' link this opens User overview page.
&lt;li&gt; Click on '''Privileges''' link this opens User overview page.
<li> Click on '''Add a new''' User link this opens Add a new User page
&lt;li&gt; Click on '''Add a new''' User link this opens Add a new User page
</ol>
&lt;/ol&gt;


<ol start="10">
&lt;ol start=&quot;10&quot;&gt;
<li> Work down this page and fill in the details as follows:
&lt;li&gt; Work down this page and fill in the details as follows:
<ol start="1" >
&lt;ol start=&quot;1&quot; &gt;
<li> '''Enter user name''' (make sure use text field is selected in drop down list)
&lt;li&gt; '''Enter user name''' (make sure use text field is selected in drop down list)
<li> Host: from the drop down list select '''Any Host'''
&lt;li&gt; Host: from the drop down list select '''Any Host'''
<li> Password: '''Enter password''' (make sure use text field is selected in drop down list)
&lt;li&gt; Password: '''Enter password''' (make sure use text field is selected in drop down list)
<li> Re-type: Enter the password again
&lt;li&gt; Re-type: Enter the password again
<li> Make sure all global privileges are UnChecked
&lt;li&gt; Make sure all global privileges are UnChecked
<li> Click on '''Go''' this creates the user account and displays the user page
&lt;li&gt; Click on '''Go''' this creates the user account and displays the user page
</ol>
&lt;/ol&gt;
</ol>
&lt;/ol&gt;


<ol start="11">
&lt;ol start=&quot;11&quot;&gt;
<li> Scroll down the user page to '''Database-specific privileges'''
&lt;li&gt; Scroll down the user page to '''Database-specific privileges'''
<li> Click on the '''drop down''' list and '''select a database''' to assign to the user.<br>
&lt;li&gt; Click on the '''drop down''' list and '''select a database''' to assign to the user.&lt;br&gt;
(Alternatively enter the database name and click on go)<br>
(Alternatively enter the database name and click on go)&lt;br&gt;
       In either case opens the user edit privileges page for that database
       In either case opens the user edit privileges page for that database
</ol>
&lt;/ol&gt;


<ol start="13">
&lt;ol start=&quot;13&quot;&gt;
<li> In the edit privileges check the following:
&lt;li&gt; In the edit privileges check the following:
<ol>
&lt;ol&gt;
<li> '''Data:''' SELECT, INSERT, UPDATE and DELETE
&lt;li&gt; '''Data:''' SELECT, INSERT, UPDATE and DELETE
<li> '''Structure:''' CREATE, ALTER, INDEX and DROP
&lt;li&gt; '''Structure:''' CREATE, ALTER, INDEX and DROP
<li> '''Administration:''' Leave all UnChecked
&lt;li&gt; '''Administration:''' Leave all UnChecked
<li> Click '''Go''' a confirmation page is displayed
&lt;li&gt; Click '''Go''' a confirmation page is displayed
</ol>
&lt;/ol&gt;
</ol>
&lt;/ol&gt;
<ol start="14">
&lt;ol start=&quot;14&quot;&gt;
<li>Repeat steps 7 to 13 for each new user.
&lt;li&gt;Repeat steps 7 to 13 for each new user.
</ol>
&lt;/ol&gt;


'''Refresh the MySQL grant tables:'''
'''Refresh the MySQL grant tables:'''


At the bottom of the '''User overview''' page (home > privileges) you will see the following statement:
At the bottom of the '''User overview''' page (home &gt; privileges) you will see the following statement:


"phpMyAdmin gets the users' privileges directly from MySQL's privilege tables. The content of these tables may differ from the privileges the server uses, if they have been changed manually. In this case, you should '''reload the privileges''' before you continue."
&quot;phpMyAdmin gets the users' privileges directly from MySQL's privilege tables. The content of these tables may differ from the privileges the server uses, if they have been changed manually. In this case, you should '''reload the privileges''' before you continue.&quot;


Click on reload the privileges link contained in the above statement this executes the query
Click on reload the privileges link contained in the above statement this executes the query


  SQL query:<br>FLUSH PRIVILEGES ;
  SQL query:&lt;br&gt;FLUSH PRIVILEGES ;


Instructing the MySQL server to take another look at the user tables and hence puts all of your new users and privileges into operation.
Instructing the MySQL server to take another look at the user tables and hence puts all of your new users and privileges into operation.
Line 113: Line 114:
Authentication has been built into phpMyAdmin since version 2.0.3 and uses the following procedure:
Authentication has been built into phpMyAdmin since version 2.0.3 and uses the following procedure:


# phpMyAdmin searches the mysql.db table for entries with Select_Priv = "Y" belonging to the user.
# phpMyAdmin searches the mysql.db table for entries with Select_Priv = &quot;Y&quot; belonging to the user.
# If no entries found, the authentication has failed.
# If no entries found, the authentication has failed.
# Otherwise, phpMyAdmin shows all databases the user is allowed to view
# Otherwise, phpMyAdmin shows all databases the user is allowed to view
# If the user's global Select_Priv is "Y", all databases in the system are shown.
# If the user's global Select_Priv is &quot;Y&quot;, all databases in the system are shown.


This allows users to log into phpMyAdmin and modify their own databases.
This allows users to log into phpMyAdmin and modify their own databases.
Line 134: Line 135:
# Scroll down the file and locate these three lines (around line 51):
# Scroll down the file and locate these three lines (around line 51):


<pre>
&lt;pre&gt;
$cfg['Servers'][$i]['auth_type'] = 'config';      // Authentication method (config, http or cookie based)?
$cfg['Servers'][$i]['auth_type'] = 'config';      // Authentication method (config, http or cookie based)?
$cfg['Servers'][$i]['user'] = 'root';            // MySQL user
$cfg['Servers'][$i]['user'] = 'root';            // MySQL user
$cfg['Servers'][$i]['password'] = implode ('', file ('../mysql_password')); // MySQL password (only needed
$cfg['Servers'][$i]['password'] = implode ('', file ('../mysql_password')); // MySQL password (only needed
                                                   // with 'config' auth_type)
                                                   // with 'config' auth_type)
</pre>
&lt;/pre&gt;


<ol start=5>
&lt;ol start=5&gt;
<li> Edit the lines to look like this:
&lt;li&gt; Edit the lines to look like this:
</ol>
&lt;/ol&gt;
<pre>
&lt;pre&gt;
$cfg['Servers'][$i]['auth_type'] = 'http';      // Authentication method (config, http or cookie based)?
$cfg['Servers'][$i]['auth_type'] = 'http';      // Authentication method (config, http or cookie based)?
$cfg['Servers'][$i]['user'] = '';                // MySQL user
$cfg['Servers'][$i]['user'] = '';                // MySQL user
$cfg['Servers'][$i]['password'] = '';            //MySQL password (only needed with 'config' auth_type)
$cfg['Servers'][$i]['password'] = '';            //MySQL password (only needed with 'config' auth_type)
</pre>
&lt;/pre&gt;


'''Testing:''' Type the following '''<nowiki>http://localhost/phpMyAdmin/</nowiki>''' into your browser.
'''Testing:''' Type the following '''&lt;nowiki&gt;http://localhost/phpMyAdmin/&lt;/nowiki&gt;''' into your browser.
You will be challenged to enter name and password.
You will be challenged to enter name and password.


Line 158: Line 159:


== Dead in the water ==
== Dead in the water ==
<div style="border:1px solid red; padding-left:4px; background: #ffcccc">
&lt;div style=&quot;border:1px solid red; padding-left:4px; background: #ffcccc&quot;&gt;
You are '''dead in the water''' if you can access the '''account root with password root''' put your servers online and kiss your MySQL server good bye.
You are '''dead in the water''' if you can access the '''account root with password root''' put your servers online and kiss your MySQL server good bye.
</div>
&lt;/div&gt;
You are the only one that should know your root password remember the server defaults to root hence every one knows this. Please check out the security checklist page (apanel) and change the root password according to the instructions found on this page.
You are the only one that should know your root password remember the server defaults to root hence every one knows this. Please check out the security checklist page (apanel) and change the root password according to the instructions found on this page.


Line 173: Line 174:


== Final test ==
== Final test ==
With your servers online, type into to your browser '''<nowiki>http://your_domain/phpmyadmin/</nowiki>''' and check that everything works.
With your servers online, type into to your browser '''&lt;nowiki&gt;http://your_domain/phpmyadmin/&lt;/nowiki&gt;''' and check that everything works.


For example <nowiki>http://www.name.dyndns.org/phpMyAdmin/</nowiki>
For example &lt;nowiki&gt;http://www.name.dyndns.org/phpMyAdmin/&lt;/nowiki&gt;


== Conclusion ==
== Conclusion ==
322

edits

Navigation menu