• Home
  • WordPress
  • web Hosting
  • linux
  • mysql
  • nginx
  • apache2
  • devops

Raju Ginni

wordpress tutorials seo hosting etc

You are here: Home / MySQL Tutorial (create,connect database, update tables, export etc) Documentation & TIPS / mysql user creation, password , grant permissions user management guide

mysql user creation, password , grant permissions user management guide

syntax works with mysql 5.7 and 8 above

Table of Contents

Toggle
  • Create mysql user with password
  • change user password
  • grant all permissions
  • Gant selectec permissions
  • view user permissions
  • Set user limits
  • flush privileges
  • view mysql users and password strings
    • mysql list users
  • mysql user authentication_string,plugin
  • view mysql user table columns mysql
  • mysql delete remove user
  • warning Plugin sha256_password reported

Create mysql user with password

CREATE USER ‘user1’@’localhost’ IDENTIFIED WITH mysql_native_password by ‘<UNIQUEPASSWORD>’;

from linuxcommad line

sudo mysql -e “CREATE USER ‘newrelic’@’localhost’ IDENTIFIED BY ‘YOUR_SELECTED_PASSWORD’;”

 

create user with ssha method

 

CREATE USER ‘user1’@’localhost’ IDENTIFIED WITH caching_sha2_password by ‘<UNIQUEPASSWORD>’;

change user password

ALTER USER ‘root’@’localhost’ IDENTIFIED WITH mysql_native_password BY ‘new-Root-Password’;

ALTER USER ‘newrelic’@’localhost’ IDENTIFIED WITH caching_sha2_password BY ‘new-Root-Password’;

ALTER USER ‘newrelic’@’127.0.0.1’ IDENTIFIED WITH caching_sha2_password BY ‘Raazk23-234’;

note: client & server mysql authentication should be same.

grant all permissions

mysql> GRANT ALL PRIVILEGES ON user.* TO ‘newrelic’@’localhost’;

Gant selectec permissions

GRANT REPLICATION CLIENT ON *.* TO ‘datadog’@’localhost’;
GRANT PROCESS ON *.* TO ‘newrelic’@’localhost’;
GRANT SELECT ON performance_schema.* TO ‘newrelic’@’localhost’;

view user permissions

mysql> SHOW GRANTS for newrelic;
ERROR 1141 (42000): There is no such grant defined for user ‘newrelic’ on host ‘%’

 

Set user limits

ALTER USER ‘datadog’@’localhost’ WITH MAX_USER_CONNECTIONS 5;

flush privileges

to reflect changes

FLUSH PRIVILEGES;

 

view mysql users and password strings

SELECT User, Host, Password, FROM mysql.user;

mysql> SELECT User, Host, Password, FROM mysql.user;
ERROR 1064 (42000): You have an error in your SQL syntax;

password column removed in mysql 8.

 

mysql list users

mysql> select user from mysql.user;
+——————+
| user             |
+——————+
| phpmyadmin       |
| mysql.infoschema |
| mysql.session    |
| mysql.sys        |
| newrelic         |
| root             |
+——————+
6 rows in set (0.00 sec

mysql user authentication_string,plugin

mysql> SELECT user,authentication_string,plugin,host FROM mysql.user;
+——————+————————————————————————+———————————-+—————-+
| user | authentication_string | plugin | host |
+——————+————————————————————————+———————————-+—————-+
| newrelic | Raazk23@#123 | 91666d34772ac6ae86c4a466af4569fc | % |
| phpmyadmin | *31C3E34632FBE2ADBF5B1AB04F8951355194A9C1 | mysql_native_password | % |
| newrelic | *549675EE947E8DC1766DC10C75202B61B4177F1E | mysql_native_password | 127.0.0.1 |
| zzz | *5FEB9D1EA7A2BFB0D7AACE1E96C11F561633AAF1 | mysql_native_password | 127.0.0.1 |
| newrelic | *5FEB9D1EA7A2BFB0D7AACE1E96C11F561633AAF1 | mysql_native_password | 128.199.25.144 |
| datadog | *5FEB9D1EA7A2BFB0D7AACE1E96C11F561633AAF1 | mysql_native_password | localhost |
| mysql.infoschema | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED | caching_sha2_password | localhost |
| mysql.session | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED | caching_sha2_password | localhost |
| mysql.sys | $A$005$THISISACOMBINATIONOFINVALIDSALTANDPASSWORDTHATMUSTNEVERBRBEUSED | caching_sha2_password | localhost |
| newrelic | *5FEB9D1EA7A2BFB0D7AACE1E96C11F561633AAF1 | mysql_native_password | localhost |
| raazk | *EC950D53E4A6704732C18B19D3C3B53934B03FBB | mysql_native_password | localhost |
| root | *31C3E34632FBE2ADBF5B1AB04F8951355194A9C1 | mysql_native_password | localhost |
+——————+————————————————————————+———————————-+—————-

view mysql user table columns mysql

SHOW COLUMNS FROM my_table;

SHOW COLUMNS FROM mysql.user;

SHOW COLUMNS FROM mysql;

| plugin | char(64) | NO | | ca ching_sha2_password | |
| authentication_string | text | YES | | NU LL | |
| password_expired | enum(‘N’,’Y’) | NO | | N

mysql delete remove user

mysql> DROP USER newrelic;

 

related Access denied for user root

mysql password reset

 

warning Plugin sha256_password reported

default_authentication_plugin = mysql nATIVE,

monitoring tool was indeed the culprit !

INSTALL PLUGIN CONNECTION_CONTROL

helps to identify the user, mycase grafana.

sudo systemctl stop grafana-agent.service

MySQL Tutorial (create,connect database, update tables, export etc) Documentation & TIPS

  • mysqldump import /export mysql database command line, phpmyadmin, Cpanel, mysql workbench, xamp
  • mysql commands
  • phpmyadmin install / configure on nginx ubuntu 20.04 apache2 debian 10
  • improve mysql performance wordpress my.cnf file configuration
  • innodb buffer pool size measure & adjust by pages, read requests etc
  • mysql workbench tutorials (Sql Development , modelling, server admin export & import)
  • mysql errors
  • Innodb vs myisam (table engines row lock vs table lock)
  • mysql max connections limit check increase how to decide thread cache size
  • MySQL innodb memory allocation & usage calculation
  • MySQL query cache vs redis vs memcached buffer pool database cache
  • mysql 8 installation on ubuntu 20.4
  • mysql configuration file location linux , windows , mac
  • mysql root password change reset update set A-Z info
  • mysql user creation, password , grant permissions user management guide
  • mysql slow query log enable disable set query time ideal mysql long query time
  • mysql access denied for user 'root'@'localhost' (using password yes) no Error 1045
  • monitoring mysql with new relic
  • mysql restart ubuntu status start stop in linux windows reload
  • mysql open_files_limit increase to raise open file cache table definition cache
  • mysql memory limit setting increase or decrease allocation
  • mysqltuner installation suggestions
  • mysql auto backup ubuntu 22.04 using automysqlbackup
  • mysql high cpu usage cases and limiting cpu usage
  • mysql oom killer
  • mysql memory parameters
  • check mysql database size and table size
  • mysql find replace wordpress posts content
  • mysql import export database command line linux ubuntu debian wamp xamp
  • mysql interview questions and answers fresher to experience

hi i am raju ginni, primalry i manage wordpress websites on GCP cloud platform as a cloud engineer, and create content on passionate things.
you can follow me on youtbe

© 2025 - All Rights Reserved Disclaimer & Privacy Policy