Recently there was a reqirement to install mysql server and to create few mysql databases. As per requirement, we created the databases but during user creation we faced the below error.
Below are the error logs and sequence of steps we followed to resolve this error:
[oradb@orahowdb mysql]$ mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 4
Server version: 5.6.40 MySQL Community Server (GPL)
Copyright (c) 2000, 2018, 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>
mysql> show databases;
+——————–+
| Database |
+——————–+
| information_schema |
|oradb |
| mysql |
| performance_schema |
+——————–+
6 rows in set (0.00 sec)
mysql> use oradb
Database changed
mysql>
mysql> create user orahow identified by ‘####’;
ERROR 1558 (HY000): Column count of mysql.user is wrong. Expected 43, found 42. Created with MySQL 50556, now running 50640. Please use mysql_upgrade to fix this error.
mysql>
mysql> exit
[oradb@orahowdb mysql]$
[oradb@orahowdb mysql]$ mysql_upgrade -u root -p
Enter password:
Looking for ‘mysql’ as: mysql
Looking for ‘mysqlcheck’ as: mysqlcheck
Running ‘mysqlcheck’ with connection arguments: ‘–port=3306’ ‘–socket=/DBdata/mysql/mysql.sock’
Warning: Using a password on the command line interface can be insecure.
Running ‘mysqlcheck’ with connection arguments: ‘–port=3306’ ‘–socket=/DBdata/mysql/mysql.sock’
Warning: Using a password on the command line interface can be insecure.
mysql.columns_priv OK
mysql.db OK
mysql.event OK
mysql.func OK
mysql.general_log OK
mysql.help_category OK
mysql.help_keyword OK
mysql.help_relation OK
mysql.help_topic OK
mysql.host OK
mysql.ndb_binlog_index OK
mysql.plugin OK
mysql.proc OK
mysql.procs_priv OK
mysql.proxies_priv OK
mysql.servers OK
mysql.slow_log OK
mysql.tables_priv OK
mysql.time_zone OK
mysql.time_zone_leap_second OK
mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.user OK
Running ‘mysql_fix_privilege_tables’…
Warning: Using a password on the command line interface can be insecure.
Running ‘mysqlcheck’ with connection arguments: ‘–port=3306’ ‘–socket=/DBdata/mysql/mysql.sock’
Warning: Using a password on the command line interface can be insecure.
Running ‘mysqlcheck’ with connection arguments: ‘–port=3306’ ‘–socket=/DBdata/mysql/mysql.sock’
Warning: Using a password on the command line interface can be insecure.
OK
Could not create the upgrade info file ‘/DBdata/mysql/mysql_upgrade_info’ in the MySQL Servers datadir, errno: 13
[oradb@orahowdb mysql]$ mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 13
Server version: 5.6.40 MySQL Community Server (GPL)
Copyright (c) 2000, 2018, 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>
mysql> show databases;
+——————–+
| Database |
+——————–+
| information_schema |
| oradb |
| mysql |
| performance_schema |
+——————–+
6 rows in set (0.00 sec)
mysql>
mysql>
mysql> use oradb;
Database changed
mysql>
mysql> create user orahow identified by ‘####’;
Query OK, 0 rows affected (0.00 sec)