- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
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)
- Related Articles
- How to connect Azure Account using PowerShell?
- How can we create a MySQL user account by omitting the hostname?
- What are the minimum MySQL user privileges to allow optimize and repair?
- Connect to MySQL database from command line
- How to connect Java to MySQL?
- How to change the local user account password using PowerShell?
- How to set the local user account settings using PowerShell?
- How can we set up a MySQL User account by using INSERT INTO statement?
- How can we set up a MySQL User account by using SQL GRANT statement?
- How to Find User Account Info and Login Details in Linux?
- How to connect hibernate with MySQL Database?
- How to prevent a user from accessing a specific schema in MySQL?
- How do I modify a MySQL column to allow NULL?
- How to copy files from host to Docker container?
- How to not allow duplicate entries to be entered a MySQL Table?

Advertisements