NetAdminTools.com
 
SignalQ Sites:
NetAdminTools - Coprolite - NoNIC - SpotBridge - NAW
RoboCoop - AreWeDown - SolarPower - SysAdminTools
Xfig - Gold Loaf - GeekPapa - FixGMC - MCJ - FixRambler
Categories:
GNU/Linux | Homebrew designs | Perl | Administration | Backup/Recovery | Bugs/Fixes | Certification | Database | Email | File/Print | Hardware | Information Grab Bag | Interoperability | GNU/Linux ABCs | Monitoring | Name Resolution | Network Services | Networking | Remote Control | Security | Desktop | Web | BSD | Solaris | GIAGD | REALbasic

Last 30 Days | Last 60 Days | Last 90 Days | All Articles | RSS | Hail Support


Categories:
·GNU/Linux
·Homebrew designs
·Perl
·Administration
·Backup/Recovery
·Bugs/Fixes
·Certification
·Database
·Email
·File/Print
·Hardware
·Information Grab Bag
·Interoperability
·GNU/Linux ABCs
·Monitoring
·Name Resolution
·Network Services
·Networking
·Remote Control
·Security
·Desktop
·Web
·BSD
·Solaris
·GIAGD
·REALbasic
·All Categories


Granting Access to Users With MySQL
Topic: Database   Posted:2005-08-07
Printer Friendly: Print

spacer
To grant access to a database for a particular user and subnet, you can use this command:

mysql> grant all privileges on arewedown.* to are@'10.50.100.0/255.255.255.0'
identified by 'arepass';
Query OK, 0 rows affected (0.00 sec)
mysql> FLUSH PRIVILEGES; 
Query OK, 0 rows affected (0.01 sec)
mysql> select User,Host from mysql.user;
+------+---------------------------+
| User | Host                      |
+------+---------------------------+
| are  | 10.50.100.0/255.255.255.0 |
| root | localhost                 |
| root | srv-1.networking7by24.com |
+------+---------------------------+
3 rows in set (0.01 sec)
mysql>

In this example, all privileges are granted to all tables in the database arewedown to the user are, connecting from 10.50.100.0-10.50.100.255. Note that there is a difference in the error received for an invalid password vs. an invalid host. Here is an error show for an invalid password from a test for the MySQL ODBC connector:



Notice that there is no immediate disconnect when you telnet to port 3306. If the user/host is not allowed, you will see a different error:



Here, even if you telnet to port 3306, you will immediately be kicked off.

For more information on the GRANT command for MySQL and associated commands, see this page.




Please read our Terms of Use
Microsoft, Windows, Windows XP, Windows 2003, Windows 2000, and NT are either trademarks or registered trademarks of Microsoft Corporation. NetAdminTools.com is not affiliated with Microsoft Corporation. Linux is a registered trademark of Linus Torvalds, and refers to the Linux kernel. The operating system of most distributions that contain the Linux kernel is GNU/Linux. All logos and trademarks in this site are property of their respective owner. Copyright 1997-2008 NetAdminTools.com

Created by:
MCJ
MCJ CMS