- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to allow a MySQL user account to connect from any host?
It is quite possible to allow a user account to connect from any host. To do so we need to create the user with the help of ‘%’ wild card character after @ character. Its syntax would be as follows −
Use mysql; CREATE USER user_name@’%’ IDENTIFIED BY password;
Here
- user_name is the name of the user we wish to make an account for.
- Password is the password we wish to make for user_account. With the help of this password, MySQL server will identify this user.
Example
In the given example we are creating a user ‘Gaurav’ by using ‘%’ character so that it can be connected to any host.
mysql> use mysql Database changed mysql> CREATE USER Gaurav@'%' IDENTIFIED BY 'password123'; Query OK, 0 rows affected (0.00 sec)
The query below will give us the privileges for the new user account Gaurav@’%’.
mysql> SHOW GRANTS FOR Gaurav@'%'; +------------------------------------+ | Grants for Gaurav@% | +------------------------------------+ | GRANT USAGE ON *.* TO 'Gaurav'@'%' | +------------------------------------+ 1 row in set (0.00 sec)
Advertisements