User Tools

Site Tools


view_create_and_delete_mysql_users

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
view_create_and_delete_mysql_users [2016/08/03 08:47] – created walkeradminview_create_and_delete_mysql_users [2023/03/09 22:35] (current) – external edit 127.0.0.1
Line 2: Line 2:
 \\  \\ 
 \\  \\ 
-Here we will look at how to View Create and Delete MySQL Users.+Here we will look at how to View Create and Delete MySQL Users.\\ 
 \\  \\ 
 Before you can do any of these tasks, you need to login with an admin user: Before you can do any of these tasks, you need to login with an admin user:
 +\\ 
 +    mysql -u root -p --- (the 'root' part assumes root is your mysql username)
 +    
 +    mysql -u root -pPassword (no space between -p and your password)
 +\\ 
 +Once logged in you can do the following:
 +\\ 
 +\\ 
 +==== To View Users ====
 +    
 +    SELECT user, host FROM mysql.user;
 +\\ 
 +==== To Create a User ====
 +    
 +    CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password';
 +    
 +    Once created, the user requires permissions
 +    
 +    GRANT ALL PRIVILEGES ON * . * TO 'newuser'@'localhost';
 +    
 +    If you want to be able to access the server from anywhere, replace localhost with %
 +    
 +    GRANT ALL PRIVILEGES ON * . * TO 'admin'@'%';
 +\\ 
 +==== To Create a New User with all Privileges and a Password ====
 +    GRANT ALL PRIVILEGES ON mydb.* TO 'username'@'%' IDENTIFIED BY 'password';
 +\\ 
 +==== To Delete a User ====
 +    
 +    DROP USER 'jeffrey'@'localhost';
 +\\ 
 \\  \\ 
  
view_create_and_delete_mysql_users.1470210428.txt.gz · Last modified: 2023/03/09 22:35 (external edit)