User: jain@jain-Latitude-5310
#1
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 25.04
Release: 25.04
Codename: plucky
#2
$ sudo apt install mysql-server -y
#3
$ mysql --version
mysql Ver 8.4.7-0ubuntu0.25.04.2 for Linux on x86_64 ((Ubuntu))
$ mysql -V
mysql Ver 8.4.7-0ubuntu0.25.04.2 for Linux on x86_64 ((Ubuntu))
#4: Start MySQL Service
$ sudo systemctl start mysql
#5: Enable MySQL to start on boot
$ sudo systemctl enable mysql
#6: Verify MySQL is Running
$ sudo systemctl status mysql
● mysql.service - MySQL Community Server
Loaded: loaded (/usr/lib/systemd/system/mysql.service; enabled; preset: enabled)
Active: active (running) since Fri 2026-08-28 08:42:03 IST; 1h 29min ago
Invocation: 9dc06742a2994e4596ffb7c804f43a5f
Main PID: 7299 (mysqld)
Status: "Server is operational"
Tasks: 37 (limit: 17977)
Memory: 428.5M (peak: 442.1M)
CPU: 59.251s
CGroup: /system.slice/mysql.service
└─7299 /usr/sbin/mysqld
Aug 28 08:42:02 jain-Latitude-5310 systemd[1]: Starting mysql.service - MySQL Community Server...
Aug 28 08:42:03 jain-Latitude-5310 systemd[1]: Started mysql.service - MySQL Community Server.
#7: Set up "root" password
Note: Below command is using default identification method -- which will cause us trouble when we will try to connect to MySQL using DBeaver
$ sudo mysql -u root
[sudo] password for jain:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 8.4.7-0ubuntu0.25.04.2 (Ubuntu)
Copyright (c) 2000, 2025, 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> ALTER USER 'root'@'localhost' IDENTIFIED BY 'root';
Query OK, 0 rows affected (0.00 sec)
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.02 sec)
mysql> ^C
mysql>
[1]+ Stopped sudo mysql -u root
$ sudo mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 11
Server version: 8.4.7-0ubuntu0.25.04.2 (Ubuntu)
Copyright (c) 2000, 2025, 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>
#8: Fixing "Access denied for user root@localhost"
mysql> SELECT user, host, plugin FROM mysql.user WHERE user='root';
+------+-----------+-------------+
| user | host | plugin |
+------+-----------+-------------+
| root | localhost | auth_socket |
+------+-----------+-------------+
1 row in set (0.01 sec)
mysql>
If the plugin is auth_socket, change it to caching_sha2_password or mysql_native_password
(Replace caching_sha2_password with mysql_native_password if your client does not support the new default.)
sql> ALTER USER 'root'@'localhost' IDENTIFIED WITH caching_sha2_password BY 'root';
sql> FLUSH PRIVILEGES;
Error changes to:
Public Key Retrieval is not allowed.
#9: Fix is to use "mysql_native_password" as authentication method
mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root';
But...
ERROR 1524 (HY000): Plugin 'mysql_native_password' is not loaded
If you really need mysql_native_password (e.g., for an old client)
You can try to load the plugin manually:
Check if the plugin is listed (but disabled):
sql> SHOW PLUGINS;
Look for mysql_native_password in the list. If it’s there but not active, you may need to enable it (** AS DESCRIBED BELOW IN #10 **).
If it’s completely missing, load it:
sql> INSTALL PLUGIN mysql_native_password SONAME 'mysql_native_password.so';
Then retry your ALTER USER ... WITH mysql_native_password ... command.
If the INSTALL PLUGIN fails, the plugin library might not be present – check your MySQL installation. In that case, stick with caching_sha2_password; almost all modern clients support it.
#10: Enabling "mysql_native_password" plugin
mysql> SHOW PLUGINS;
+----------------------------------+----------+--------------------+----------------+---------+
| Name | Status | Type | Library | License |
+----------------------------------+----------+--------------------+----------------+---------+
| binlog | ACTIVE | STORAGE ENGINE | NULL | GPL |
| sha256_password | ACTIVE | AUTHENTICATION | NULL | GPL |
| caching_sha2_password | ACTIVE | AUTHENTICATION | NULL | GPL |
| sha2_cache_cleaner | ACTIVE | AUDIT | NULL | GPL |
| daemon_keyring_proxy_plugin | ACTIVE | DAEMON | NULL | GPL |
| CSV | ACTIVE | STORAGE ENGINE | NULL | GPL |
| MEMORY | ACTIVE | STORAGE ENGINE | NULL | GPL |
| InnoDB | ACTIVE | STORAGE ENGINE | NULL | GPL |
| INNODB_TRX | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_CMP | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_CMP_RESET | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_CMPMEM | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_CMPMEM_RESET | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_CMP_PER_INDEX | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_CMP_PER_INDEX_RESET | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_BUFFER_PAGE | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_BUFFER_PAGE_LRU | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_BUFFER_POOL_STATS | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_TEMP_TABLE_INFO | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_METRICS | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_FT_DEFAULT_STOPWORD | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_FT_DELETED | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_FT_BEING_DELETED | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_FT_CONFIG | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_FT_INDEX_CACHE | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_FT_INDEX_TABLE | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_TABLES | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_TABLESTATS | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_INDEXES | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_TABLESPACES | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_COLUMNS | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_VIRTUAL | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_CACHED_INDEXES | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| INNODB_SESSION_TEMP_TABLESPACES | ACTIVE | INFORMATION SCHEMA | NULL | GPL |
| MyISAM | ACTIVE | STORAGE ENGINE | NULL | GPL |
| MRG_MYISAM | ACTIVE | STORAGE ENGINE | NULL | GPL |
| PERFORMANCE_SCHEMA | ACTIVE | STORAGE ENGINE | NULL | GPL |
| TempTable | ACTIVE | STORAGE ENGINE | NULL | GPL |
| ARCHIVE | ACTIVE | STORAGE ENGINE | NULL | GPL |
| BLACKHOLE | ACTIVE | STORAGE ENGINE | NULL | GPL |
| FEDERATED | DISABLED | STORAGE ENGINE | NULL | GPL |
| ndbcluster | DISABLED | STORAGE ENGINE | NULL | GPL |
| ndbinfo | DISABLED | STORAGE ENGINE | NULL | GPL |
| ndb_transid_mysql_connection_map | DISABLED | INFORMATION SCHEMA | NULL | GPL |
| ngram | ACTIVE | FTPARSER | NULL | GPL |
| mysqlx_cache_cleaner | ACTIVE | AUDIT | NULL | GPL |
| mysqlx | ACTIVE | DAEMON | NULL | GPL |
| mysql_native_password | DISABLED | AUTHENTICATION | NULL | GPL |
| auth_socket | ACTIVE | AUTHENTICATION | auth_socket.so | GPL |
+----------------------------------+----------+--------------------+----------------+---------+
49 rows in set (0.00 sec)
mysql>
*** Only if you absolutely need mysql_native_password ***
If you have a very old client/library that doesn't support caching_sha2_password, you can re-enable the disabled plugin.
Because the plugin is built-in but disabled, you cannot simply INSTALL it—you must enable it in the server configuration and restart MySQL.
Step 1: Edit the MySQL config file:
bash
sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf
Step 2: Add this line under the [mysqld] section:
ini
[mysqld]
mysql_native_password=ON
Step 3: Save the file and restart MySQL:
bash
sudo systemctl restart mysql
Step 4: Now the plugin will show ACTIVE. Log in with sudo and change the root user:
sql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root';
sql> FLUSH PRIVILEGES;
Now test without sudo—it will also work.
Testing:
mysql> show plugins;
+----------------------------------+----------+--------------------+----------------+---------+
| Name | Status | Type | Library | License |
+----------------------------------+----------+--------------------+----------------+---------+
...
| mysql_native_password | ACTIVE | AUTHENTICATION | NULL | GPL |
...
+----------------------------------+----------+--------------------+----------------+---------+
Pages
- Index of Lessons in Technology
- Index of Book Summaries
- Index of Book Lists And Downloads
- Index For Job Interviews Preparation
- Index of "Algorithms: Design and Analysis"
- Python Course (Index)
- Data Analytics Course (Index)
- Index of Machine Learning
- Postings Index
- Index of BITS WILP Exam Papers and Content
- Lessons in Investing
- Index of Math Lessons
- Index of Management Lessons
- Book Requests
- Index of English Lessons
- Index of Medicines
- Index of Quizzes (Educational)
Friday, August 28, 2026
Steps to MySQL Installation (on Ubuntu) and Connection using DBeaver (2026 Aug)
Labels:
Database
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment