mysql replication and GRANT that doesn't quite grant - mysql

I am trying to set up mysql replication. All's well, but I see an error 1045 for the slave:
mysql> show slave status\G
*************************** 1. row ***************************
Slave_IO_State: Connecting to master
Master_Host: <my.host.ip>
Master_User: slave_user
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000001
Read_Master_Log_Pos: 107
Relay_Log_File: mysqld-relay-bin.000003
Relay_Log_Pos: 4
Relay_Master_Log_File: mysql-bin.000001
Slave_IO_Running: Connecting
Slave_SQL_Running: Yes
Replicate_Do_DB: my_db_name
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 0
Last_Error:
Skip_Counter: 0
Exec_Master_Log_Pos: 107
Relay_Log_Space: 107
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master: NULL
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 1045
Last_IO_Error: error connecting to master 'slave_user#my.host.ip:3306' - retry-time: 60 retries: 86400
Last_SQL_Errno: 0
Last_SQL_Error:
Replicate_Ignore_Server_Ids:
Master_Server_Id: 0
1 row in set (0.00 sec)
mysql>
I try connecting manually, it starts out fine, but I've a permission problem:
$ mysql -h my-host-name -u slave_user -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 46
Server version: 5.5.49-0ubuntu0.14.04.1-log (Ubuntu)
Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
+--------------------+
1 row in set (0.00 sec)
mysql> use my_db_name;
ERROR 1044 (42000): Access denied for user 'slave_user'#'%.my-domain.com' to database 'my_db_name'
mysql>
But on the master, I created the slave user thus, which seems to be more than adequate:
CREATE USER 'slave_user'#'%.my-domain.com'
IDENTIFIED BY 'changeme';
GRANT REPLICATION SLAVE ON *.* TO 'slave_user'#'%.my-domain.com';
(In passing: I think I would have preferred GRANT REPLICATION SLAVE ON my_db_name.* TO 'slave_user'#'%.my-domain.com';, but that is an error, and I should get this working first.)
mysql> select * from mysql.user where user = 'slave_user'\G
*************************** 1. row ***************************
Host: %.my-domain.com
User: slave_user
Password: *la-de-da-da-nothing-to-see-here-hashed
Select_priv: N
Insert_priv: N
Update_priv: N
Delete_priv: N
Create_priv: N
Drop_priv: N
Reload_priv: N
Shutdown_priv: N
Process_priv: N
File_priv: N
Grant_priv: N
References_priv: N
Index_priv: N
Alter_priv: N
Show_db_priv: N
Super_priv: N
Create_tmp_table_priv: N
Lock_tables_priv: N
Execute_priv: N
Repl_slave_priv: Y
Repl_client_priv: N
Create_view_priv: N
Show_view_priv: N
Create_routine_priv: N
Alter_routine_priv: N
Create_user_priv: N
Event_priv: N
Trigger_priv: N
Create_tablespace_priv: N
ssl_type:
ssl_cipher:
x509_issuer:
x509_subject:
max_questions: 0
max_updates: 0
max_connections: 0
max_user_connections: 0
plugin:
authentication_string: NULL
1 row in set (0.00 sec)
mysql>
Any suggestions?

Related

Root or Admin User Not Present in mysql.user (only mysql.infoschema, mysql.session, mysql.sys)

[?] What should I do to normally do sudo mysql -u root -p if it always returns Access denied? [MySQL 8.0] [Ubuntu 20.04]
After clean uninstall mysql and mariadb, then install mysql, at first I got some errors but I can fix it (by configuring my.cnf file and do mysqld --upgrade=force), then finally the mysql service can be started.
However, I got this error whenever tried to access mysql root user
$ sudo mysql -u root -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: NO)
Please, I really need help for this :(
And please elaborate me about what I should do to complete the given steps, I'm afraid I don't really understand the basic of Ubuntu system :(
Thank you so much for any effort you guys tried to help me, I really really appreciate it!
What I Tried
To at least access mysql, I add skip-grant-tables on my.cnf.
(However, I cannot do anything such as create user, etc, both inside and outside safe configuration mode.)
$ sudo mysql -u root -p # this only uses blank password
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 7
Server version: 8.0.31-0ubuntu0.20.04.2 (Ubuntu)
Copyright (c) 2000, 2022, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> SELECT USER();
+--------+
| USER() |
+--------+
| root# |
+--------+
1 row in set (0,01 sec)
mysql> CREATE USER 'root'#'localhost' IDENTIFIED BY 'root';
ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement
mysql> SELECT user, host FROM mysql.user;
+------------------+-----------+
| user | host |
+------------------+-----------+
| mysql.infoschema | localhost |
| mysql.session | localhost |
| mysql.sys | localhost |
+------------------+-----------+
3 rows in set (0,00 sec)
mysql> SELECT * FROM mysql.user\G
*************************** 1. row ***************************
Host: localhost
User: mysql.infoschema
Select_priv: Y
Insert_priv: N
Update_priv: N
Delete_priv: N
Create_priv: N
Drop_priv: N
Reload_priv: N
Shutdown_priv: N
Process_priv: N
File_priv: N
Grant_priv: N
References_priv: N
Index_priv: N
Alter_priv: N
Show_db_priv: N
Super_priv: N
Create_tmp_table_priv: N
Lock_tables_priv: N
Execute_priv: N
Repl_slave_priv: N
Repl_client_priv: N
Create_view_priv: N
Show_view_priv: N
Create_routine_priv: N
Alter_routine_priv: N
Create_user_priv: N
Event_priv: N
Trigger_priv: N
Create_tablespace_priv: N
...
*************************** 2. row ***************************
Host: localhost
User: mysql.session
Select_priv: N
Insert_priv: N
Update_priv: N
Delete_priv: N
Create_priv: N
Drop_priv: N
Reload_priv: N
Shutdown_priv: Y
Process_priv: N
File_priv: N
Grant_priv: N
References_priv: N
Index_priv: N
Alter_priv: N
Show_db_priv: N
Super_priv: Y
Create_tmp_table_priv: N
Lock_tables_priv: N
Execute_priv: N
Repl_slave_priv: N
Repl_client_priv: N
Create_view_priv: N
Show_view_priv: N
Create_routine_priv: N
Alter_routine_priv: N
Create_user_priv: N
Event_priv: N
Trigger_priv: N
Create_tablespace_priv: N
...
*************************** 3. row ***************************
Host: localhost
User: mysql.sys
Select_priv: N
Insert_priv: N
Update_priv: N
Delete_priv: N
Create_priv: N
Drop_priv: N
Reload_priv: N
Shutdown_priv: N
Process_priv: N
File_priv: N
Grant_priv: N
References_priv: N
Index_priv: N
Alter_priv: N
Show_db_priv: N
Super_priv: N
Create_tmp_table_priv: N
Lock_tables_priv: N
Execute_priv: N
Repl_slave_priv: N
Repl_client_priv: N
Create_view_priv: N
Show_view_priv: N
Create_routine_priv: N
Alter_routine_priv: N
Create_user_priv: N
Event_priv: N
Trigger_priv: N
Create_tablespace_priv: N
...
3 rows in set (0,00 sec)
Also error on doing secure installation
$ mysql_secure_installation
Securing the MySQL server deployment.
Enter password for user root:
Error: Access denied for user 'root'#'localhost' (using password: YES)
my.cnf file
[client]
port = 3306
socket = /var/run/mysqld/mysqld.sock
[mysqld_safe]
socket = /var/run/mysqld/mysqld.sock
nice = 0
[mysqld]
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
lc_messages_dir = /usr/share/mysql
lc_messages = en_US
skip-external-locking
# skip-grant-tables
bind-address = 127.0.0.1
max_connections = 100
connect_timeout = 5
wait_timeout = 600
max_allowed_packet = 16M
thread_cache_size = 128
sort_buffer_size = 4M
bulk_insert_buffer_size = 16M
tmp_table_size = 32M
max_heap_table_size = 32M
myisam_recover_options = BACKUP
key_buffer_size = 128M
table_open_cache = 400
myisam_sort_buffer_size = 512M
concurrent_insert = 2
read_buffer_size = 2M
read_rnd_buffer_size = 1M
# general_log_file = /var/log/mysql/mysql.log
slow_query_log_file = /var/log/mysql/mariadb-slow.log
long_query_time = 10
log_bin = /var/log/mysql/mariadb-bin
log_bin_index = /var/log/mysql/mariadb-bin.index
default_storage_engine = InnoDB
innodb_buffer_pool_size = 256M
innodb_log_buffer_size = 8M
innodb_file_per_table = 1
innodb_open_files = 400
innodb_io_capacity = 400
innodb_flush_method = O_DIRECT
[galera]
[mysqldump]
quick
quote-names
max_allowed_packet = 16M
[mysql]
[isamchk]
key_buffer = 16M
# Error handling after installation by commenting this out
# system status error handling (these variables unknown)
# query_cache_limit = 128K
# query_cache_size = 64M
# expire_logs_days = 10
# max_binlog_size = 100M
# $ mysqld --upgrade=force error handling (these variables unknown)
# log_warnings = 2
# log_slow_verbosity = query_plan
MySQL status
$ sudo systemctl status mysql
● mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: active (running) since Thu 2022-12-01 14:40:12 WIB; 12min ago
Main PID: 247973 (mysqld)
Status: "Server is operational"
Tasks: 38 (limit: 6878)
Memory: 312.6M
CGroup: /system.slice/mysql.service
└─247973 /usr/sbin/mysqld
Des 01 14:40:04 EMP10 systemd[1]: Starting MySQL Community Server...
Des 01 14:40:05 EMP10 mysqld[247973]: 2022-12-01T07:40:05.235618Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.31-0ubuntu0.20.04.2) starting as process 247973
Des 01 14:40:05 EMP10 mysqld[247973]: 2022-12-01T07:40:05.272065Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
Des 01 14:40:09 EMP10 mysqld[247973]: 2022-12-01T07:40:09.042423Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
Des 01 14:40:12 EMP10 mysqld[247973]: 2022-12-01T07:40:12.258475Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
Des 01 14:40:12 EMP10 mysqld[247973]: 2022-12-01T07:40:12.258535Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
Des 01 14:40:12 EMP10 mysqld[247973]: 2022-12-01T07:40:12.474475Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /var/run/mysqld/mysqlx.sock
Des 01 14:40:12 EMP10 mysqld[247973]: 2022-12-01T07:40:12.474611Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.31-0ubuntu0.20.04.2' socket: '/var/run/mysqld/mysqld.sock' port: 3306 (Ubuntu).
Des 01 14:40:12 EMP10 systemd[1]: Started MySQL Community Server.
Actually, if the suggestion is only to uninstall and install mysql, the later installing always gives me errors to handle :(
I usually did these to clean uninstall and install mysql
$ sudo systemctl stop mysql
$ dpkg -l | grep mysql
ii mysql-client-8.0 8.0.31-0ubuntu0.20.04.2 amd64 MySQL database client binaries
ii mysql-client-core-8.0 8.0.31-0ubuntu0.20.04.2 amd64 MySQL database core client binaries
ii mysql-common 1:10.3.37+maria~ubu1804 all MariaDB database common files (e.g. /etc/mysql/my.cnf)
ii mysql-server 8.0.31-0ubuntu0.20.04.2 all MySQL database server (metapackage depending on the latest version)
ii mysql-server-8.0 8.0.31-0ubuntu0.20.04.2 amd64 MySQL database server binaries and system database setup
ii mysql-server-core-8.0 8.0.31-0ubuntu0.20.04.2 amd64 MySQL database server binaries
$ sudo apt remove --purge mysql-client-* mysql-common mysql-server*
$ sudo rm -rf /etc/mysql /var/lib/mysql /var/log/mysql
$ sudo apt autoremove
$ sudo apt autoclean
$ sudo apt install mysql-server # or $ sudo apt install mysql-server-8.0 mysql-server-core-8.0
After installation, there must be something errors to handle.
Reinstalling also didn't fix
$ sudo apt install --reinstall mysql-server # or $ sudo apt install mysql-server-8.0 mysql-server-core-8.0

I've tried any way. SUPER PRIVILEGE CANNOT BE GRANTED I tried set log_bin_trust_function_creators

I tried
mysql> SHOW GLOBAL VARIABLES LIKE 'log_bin_trust_function_creators';
+---------------------------------+-------+
| Variable_name | Value |
+---------------------------------+-------+
| log_bin_trust_function_creators | ON |
+---------------------------------+-------+
1 row in set (0.00 sec)
You can see that it is well set up.
Then it restarted the RDS.
The database has been refreshed several times.
In addition, the following can be identified:
mysql> SELECT * FROM mysql.user WHERE User='new_root' and Host='%'\G
*************************** 1. row ***************************
Host: %
User: new_root
Select_priv: Y
Insert_priv: Y
Update_priv: Y
Delete_priv: Y
Create_priv: Y
Drop_priv: Y
Reload_priv: Y
Shutdown_priv: N
Process_priv: Y
File_priv: N
Grant_priv: Y
References_priv: Y
Index_priv: Y
Alter_priv: Y
Show_db_priv: Y
Super_priv: N
Create_tmp_table_priv: Y
Lock_tables_priv: Y
Execute_priv: Y
Repl_slave_priv: Y
Repl_client_priv: Y
Create_view_priv: Y
Show_view_priv: Y
Create_routine_priv: Y
Alter_routine_priv: Y
Create_user_priv: Y
Event_priv: Y
Trigger_priv: Y
Create_tablespace_priv: N
ssl_type:
ssl_cipher:
x509_issuer:
x509_subject:
max_questions: 0
max_updates: 0
max_connections: 0
max_user_connections: 0
plugin: mysql_native_password
authentication_string: *5EDA56336D7A85D9D6FC7EEBFE91E063ACD5A87E
password_expired: N
password_last_changed: 2020-03-12 06:25:00
password_lifetime: NULL
account_locked: N
1 row in set (0.00 sec)
mysql> GRANT ALL privileges ON *.* TO 'new_root'#'%' IDENTIFIED BY 'password';
ERROR 1045 (28000): Access denied for user 'new_root'#'%' (using password: YES)
mysql> UPDATE mysql.user SET Super_Priv='Y' WHERE user='new_root' AND host='%';
ERROR 1644 (45000): SUPER PRIVILEGE CANNOT BE GRANTED
mysql> SET GLOBAL time_zone = 'Asia/Seoul';
ERROR 1227 (42000): Access denied; you need (at least one of) the SUPER privilege(s) for this operation
I finally tried to change global time.
Only hopeless emotions soar.
What's piled up on the stream had a lot of relevant information, but I don't know if my search is poor or unusual.
I stayed awake for five hours to change this global time.
Can you help me? I'm very, very tired.
My mysql version is...
mysql> SELECT VERSION();
+------------+
| VERSION() |
+------------+
| 5.7.26-log |
+------------+
1 row in set (0.00 sec)
I solved.
If you use RDS, it doesn't seem like you have full authority like localhost.
I solved the problem by changing the time_zone in the parameter group, instead of the original attempt of using SET GLOBAL time_zone = 'Asia/Seoul'.

MySQL multi source replication

Can somebody write me step by step how to make multi source replication. I read a lot of info about it but i have a problem with gtid-mode. I turn on gtid-mode in my.ini file on the master computer but when i make dump on databases i got error with gtid executed need to be empty.
Try to execute:
slave> reset master;
slave> source dump.sql;
slave> start slave;
slave> show slave statusG
[...]
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
[...]
10:53:52 Restoring C:\Users\KasiSTD\Desktop\master3-1.sql Running: mysql.exe --defaults-file="c:\users\kasistd\appdata\local\temp\tmpmw0avv.cnf" --protocol=tcp --host=localhost --user=root --port=3306 --default-character-set=utf8 --comments < "C:\Users\KasiSTD\Desktop\master3-1.sql" ERROR 1840 (HY000) at line 26: ##GLOBAL.GTID_PURGED can only be set when ##GLOBAL.GTID_EXECUTED is empty. Operation failed with exitcode 1 10:53:53 Import of C:\Users\KasiSTD\Desktop\master3-1.sql has finished with 1 errors
This is error from mysql server 5.7 when i try to make import backup file
This is my.ini file only changes in [mysqld] log-bin=mysql-bin binlog-do-db=master3 auto_increment_increment = 2 gtid-mode = on enforce-gtid-consistency = 1 Server Id server-id=4
mysql> show slave status for channel 'master-joro'\G
*************************** 1. row ***************************
Slave_IO_State: Connecting to master
Master_Host: 192.168.1.62
Master_User: joro
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000003
Read_Master_Log_Pos: 1066
Relay_Log_File: mysql-relay-bin-master#002djoro.000001
Relay_Log_Pos: 4
Relay_Master_Log_File: mysql-bin.000003
Slave_IO_Running: Connecting
Slave_SQL_Running: Yes
Replicate_Do_DB: id,master2,final_repl
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 0
Last_Error:
Skip_Counter: 0
Exec_Master_Log_Pos: 1066
Relay_Log_Space: 154
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master: NULL
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 0
Last_IO_Error:
Last_SQL_Errno: 0
Last_SQL_Error:
Replicate_Ignore_Server_Ids:
Master_Server_Id: 0
Master_UUID:
Master_Info_File: mysql.slave_master_info
SQL_Delay: 0
SQL_Remaining_Delay: NULL
Slave_SQL_Running_State: Slave has read all relay log; waiting for more up
dates
Master_Retry_Count: 86400
Master_Bind:
Last_IO_Error_Timestamp:
Last_SQL_Error_Timestamp:
Master_SSL_Crl:
Master_SSL_Crlpath:
Retrieved_Gtid_Set:
Executed_Gtid_Set: 2069dbc8-2c85-11e6-b4ce-0027136c5f75:1
Auto_Position: 0
Replicate_Rewrite_DB:
Channel_Name: master-joro
Master_TLS_Version:
1 row in set (0.00 sec)

On Mac command-line, how to execute a SQL statement in file foo.sql and export result in tab separated form into another file?

On Mac command-line,
$ sql -u foo -pbar db -B -e "SELECT * FROM t" > output.txt
requires entering the command inline.
How to execute a SQL statement in file foo.sql and still export result in tab separated form into another file?
EDIT
When I do
mysql -h localhost -u foo -pbar db -B -e "SELECT * FROM t WHERE x='{}' LIMIT 2 INTO OUTFILE '../o.tsv';"
I got error
ERROR 1045 (28000) at line 1: Access denied for user 'foo'#'localhost' (using password: YES)
But strangely,
mysql -h localhost -u foo -pbar db
gives me mysql command prompt fine. Does using OUTFILE require user foo having a special previlege?
mysql> SELECT * FROM user WHERE User='foo'\G
*************************** 1. row ***************************
Host: localhost
User: foo
Password: *A5DB2D927D6DF94DA5E1CE4B2AEAAB4D8304EA
Select_priv: N
Insert_priv: N
Update_priv: N
Delete_priv: N
Create_priv: N
Drop_priv: N
Reload_priv: N
Shutdown_priv: N
Process_priv: N
File_priv: N
Grant_priv: N
References_priv: N
Index_priv: N
Alter_priv: N
Show_db_priv: N
Super_priv: N
Create_tmp_table_priv: N
Lock_tables_priv: N
Execute_priv: N
Repl_slave_priv: N
Repl_client_priv: N
Create_view_priv: N
Show_view_priv: N
Create_routine_priv: N
Alter_routine_priv: N
Create_user_priv: N
ssl_type:
ssl_cipher:
x509_issuer:
x509_subject:
max_questions: 0
max_updates: 0
max_connections: 0
max_user_connections: 0
1 row in set (0.01 sec)
Does:
sql -u foo -pbar db -B -e `cat foo.sql` > output.txt
work?
After setting File_priv to true, it works.
Use SELECT [text of query] INTO OUTFILE [filename]. Here's the documentation. If the format isn't exactly what you want, see the load data infile syntax for formatting commands you can specify after the filename.

Root account wont work in MySQL

I am logged in as root in my MySQL database. I try to run the following commands:
mysql> GRANT ALL ON *.* TO 'root'#'%'
-> IDENTIFIED BY '[password]'
-> WITH GRANT OPTION;
ERROR 1045 (28000): Access denied for user 'root'#'%' (using password: YES)
mysql>
I get the following error:
ERROR 1045 (28000): Access denied for user 'root'#'%' (using password: YES)
Im assuming my root user isnt set up correctly. Any ideas?
Edit
mysql> show grants for root
-> ;
+-----------------------------------------------------------------------------------------------------+
| Grants for root#% |
+-----------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'root'#'%' IDENTIFIED BY PASSWORD '*738393F115A47ACE272D98F4719B8491A2B8296F' |
| GRANT ALL PRIVILEGES ON `sometable`.* TO 'root'#'%' WITH GRANT OPTION |
| GRANT ALL PRIVILEGES ON `Test`.* TO 'root'#'%' WITH GRANT OPTION |
+-----------------------------------------------------------------------------------------------------+
3 rows in set (0.00 sec)
You might be logged into the database with an account named root, but the account you are in as does not have the correct privileges.
mysql> select user();
And follow that up with a:
mysql> select * from mysql.user\G
Look for the user and host columns to match exactly as the output. Look for grant_priv and it needs to say Y. More than likely there is additional root accounts without the grant_priv.
mysql> select * from mysql.user\G
*************************** 1. row ***************************
Host: localhost
User: root
Password: xxxxxxxxxxxxxxx
Select_priv: Y
Insert_priv: Y
Update_priv: Y
Delete_priv: Y
Create_priv: Y
Drop_priv: Y
Reload_priv: Y
Shutdown_priv: Y
Process_priv: Y
File_priv: Y
Grant_priv: Y
References_priv: Y
Index_priv: Y
Alter_priv: Y
Show_db_priv: Y
Super_priv: Y
Create_tmp_table_priv: Y
Lock_tables_priv: Y
Execute_priv: Y
Repl_slave_priv: Y
Repl_client_priv: Y
Create_view_priv: Y
Show_view_priv: Y
Create_routine_priv: Y
Alter_routine_priv: Y
Create_user_priv: Y
Event_priv: Y
Trigger_priv: Y
ssl_type:
ssl_cipher:
x509_issuer:
x509_subject:
max_questions: 0
max_updates: 0
max_connections: 0
max_user_connections: 0
When I enter the select * from mysql.user\G command, I get : ERROR 1142 (42000): SELECT command denied to user 'root'#'localhost' for table 'user' ERROR: No query specified
This means you're not logged in as 'root'#'%'. You're logged in as 'root'#'localhost', which are two different users. If you run SELECT USER(); as mentioned above, it will likely show you 'root'#'localhost'.
If you are logged in as 'root'#'localhost', you are logging in via local socket. Logging in through a TCP connection will get you access as 'root'#'%', which will then give you access to change grants based on the output you listed initially. To do so, login with:
mysql -u $user -p $pass -h 127.0.0.1