Sample Header Ad - 728x90

Database Administrators

Q&A for database professionals who wish to improve their database skills

Latest Questions

0 votes
2 answers
139 views
Unable to Add New Database in CloudPanel VPS - Access denied for user 'root'@'localhost'
**Problem** I'm facing an issue with my VPS running CloudPanel where I cannot add new databases due to MySQL root access being denied. **Environment** - CloudPanel on VPS - MySQL Server - Hosting Provider: Hostinger **Error Message** `Access denied for user 'root'@'localhost'` **Steps I've Tried** *...
**Problem** I'm facing an issue with my VPS running CloudPanel where I cannot add new databases due to MySQL root access being denied. **Environment** - CloudPanel on VPS - MySQL Server - Hosting Provider: Hostinger **Error Message** Access denied for user 'root'@'localhost' **Steps I've Tried** **1. Attempted direct MySQL login:** mysql -u root -p Result: Access denied error, tried multiple password combinations including: - Root user password - Hostinger password - Default passwords like (12345, admin, root, etc..) - No password **2. Attempted MySQL safe mode:** sudo systemctl stop mysql sudo mysqld_safe --skip-grant-tables & Result: Error message: MySQL cannot start in safe mode because the required directory for the UNIX socket file does not exist. **3. Attempted to kill running processes:** sudo kill -9 Result: No process found with specified PID **4. Created missing directory and set permissions:** sudo mkdir -p /var/run/mysqld sudo chown -R mysql:mysql /var/run/mysqld **5. Restarted MySQL in safe mode and verified process:** sudo mysqld_safe --skip-grant-tables & ps aux | grep mysql Result: Process found running **6. Attempted passwordless root login:** mysql -u root Result: Still encountering access denied error **Additional Context** - Hostinger support was unable to resolve the issue - CloudPanel tutorials show database creation through UI without command-line intervention - Suspect issue might be related to CloudPanel's default MySQL user restrictions *I have reached out to Hostinger support, but they were unable to provide a solution beyond what I have already attempted. Additionally, all the YouTube tutorials on setting up and creating a database in CloudPanel show a straightforward process with no access issues, as everything can be done directly from the UI without requiring any command-line input. I suspect it might be related to CloudPanel’s default MySQL user restrictions or authentication settings, but I’m not sure how to proceed. Has anyone encountered a similar issue or knows how to regain root access?*
Joe (1 rep)
Feb 2, 2025, 10:31 AM • Last activity: Aug 5, 2025, 02:10 PM
0 votes
1 answers
255 views
MySQL denied me access after changing my password
I am new to MySQL. Today is my first day using it through XAMPP. I have managed to change my password using the code mysqladmin -u root password Suddenly I was denied access from XAMPP and from the MySQL Admin portal. I tried to reset the password immediately in the same window using the same comman...
I am new to MySQL. Today is my first day using it through XAMPP. I have managed to change my password using the code mysqladmin -u root password Suddenly I was denied access from XAMPP and from the MySQL Admin portal. I tried to reset the password immediately in the same window using the same command but I was given the error mysqladmin: connect to server at 'localhost' failed error: 'Access denied for user 'root'@'localhost' (using password: NO)' I saw a number of related questions here on stackoverflow but they were all about phpMyAdmin password issues. I would like to rest it to the default password and gain access to MySQL & XAMPP again. I have been going around in circles for an hour. Any help would be appreciated.
Learner123
May 13, 2023, 10:41 PM • Last activity: May 27, 2025, 03:06 PM
3 votes
2 answers
2454 views
Unable to run mariadb in safe mode
When I run following command `mysqld_safe --skip-grant-tables &` I get message `myuser@myvm:~$ 200523 08:24:41 mysqld_safe Logging to syslog. 200523 08:24:41 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql` After that when I type `mysql` then I get following error: `ERROR 2002...
When I run following command mysqld_safe --skip-grant-tables & I get message `myuser@myvm:~$ 200523 08:24:41 mysqld_safe Logging to syslog. 200523 08:24:41 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql` After that when I type mysql then I get following error: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2 "No such file or directory") How do I restart mariadb in safe mode to reset root password?
Frank Martin (451 rep)
May 23, 2020, 12:30 PM • Last activity: Apr 13, 2025, 09:00 AM
0 votes
1 answers
1382 views
problem installing mariadb using mysql_secure_installation
I started secure install of MySQL with `sudo mysql_secure_installation` command, and I got that message: Securing the MySQL server deployment. Enter password for user root: Error: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) Thanks for answers
I started secure install of MySQL with sudo mysql_secure_installation command, and I got that message: Securing the MySQL server deployment. Enter password for user root: Error: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) Thanks for answers
Orestas Nastulevicius (1 rep)
Nov 29, 2021, 06:51 PM • Last activity: Jul 19, 2024, 05:03 PM
0 votes
0 answers
91 views
MySQL: Reconnect to Existing Database that I lost access to
Note I am not a programmer by trade. I have the most annoying problem ever while using MySQL 8.0, and all online resources I've seen provide zero solutions. I have one of those MySQL data directories that contains folder names such as "#innodb_redo", "#innodb_temp", "mysql", "performance_schema", an...
Note I am not a programmer by trade. I have the most annoying problem ever while using MySQL 8.0, and all online resources I've seen provide zero solutions. I have one of those MySQL data directories that contains folder names such as "#innodb_redo", "#innodb_temp", "mysql", "performance_schema", and "sys". It also has a database in it, call it "database1". This data directory is already in existence, and I had been using it for years. Something had happened to to my ability to access database1---the root password would not be accepted anymore, even when I tried to reset it, and I had to re-install all MySQL programs. **Now, I am attempting to reconnect MySQL to my extant database**. I have tried to re-install MySQL/initialize a new server, but that requires an empty data directory and does not help me. I have tried to manually copy/paste my database1 data into the new data directory; I have tried removing replacing all the folders in the new data directory (e.g., all the new "#innodb_temp", "mysql", "performance_schema", and "sys" folders) with my old data directory. I have tried changing the directory altogether. Nothing works. If I replace all the files in the new data directory with my old data directory, the root password no longer works and I have to re-install MySQL again, because the instructions to reset the password do not work. If I just try to copy/paste *only* the database1 folder directly into the new directory, it is not recognized as a database when I log into the server (it doesn't appear when I load Workbench, nor when I call 'show databases'). I can't use mysqldump on my old data because I had lost access to the server already. I can't restore the InnoDB files because I don't know the table structure to all of my tables, and 8.0 doesn't use .frm file types. **Please help me.** I can literally see the files for each table for my database1 (only in .ibd, .myi, and .myd because I'm in MySQL 8.0) as well as all other "old" server information (i.e., "#innodb_temp", "mysql", "performance_schema", and "sys") but I CANNOT ACCESS IT. IT IS SO FRUSTRATING. I have no idea why it is so difficult to access data files that I know exist and I know I have the programs that theoretically can load it. They just refuse to.
ZZ Top (1 rep)
Feb 2, 2024, 11:34 PM • Last activity: Feb 3, 2024, 10:22 AM
0 votes
1 answers
527 views
Reset root password in MySQL
I am logging in with root user in MySQL, and the server has been hardened, so this parameter is set ```default-authentication-plugin=caching_sha2_password```, and this is currently the only user I have. getting the following error: ```ERROR 1820 (HY000): You must reset your password using ALTER USER...
I am logging in with root user in MySQL, and the server has been hardened, so this parameter is set
-authentication-plugin=caching_sha2_password
, and this is currently the only user I have. getting the following error:
1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
datascinalyst (105 rep)
Nov 24, 2023, 07:32 AM • Last activity: Nov 24, 2023, 04:55 PM
1 votes
0 answers
380 views
Changing root and user passwords in MariaDB 10.5?
We have a few MariaDB servers (MariaDB 10.5, running on Debian 11/bullseye) where we need to change the passwords for the DB root user and for other user accounts in the DB system (by which I mean users in MariaDB itself, not Linux account passwords). These DB servers were set up at varying times bu...
We have a few MariaDB servers (MariaDB 10.5, running on Debian 11/bullseye) where we need to change the passwords for the DB root user and for other user accounts in the DB system (by which I mean users in MariaDB itself, not Linux account passwords). These DB servers were set up at varying times but are all at least a few years old, and the OS and DB packages have been upgraded in place since then. I was uncertain of the correct way to update the DB root user password (it having been originally set via mysql_secure_installation way back whenever when(!)), but after some researching, it now seems to turn out that, from MariaDB 10.4 onwards, MariaDB allows local root account access via unix_socket authentication . In fact, it looks as though during one of the DB upgrades, the use of the previously set DB root password was dropped from our systems without us noticing (as we still had .my.cnf files, we didn't realise)? (See output below)
MariaDB [(none)]> SHOW GRANTS FOR 'root'@'localhost';
+------------------------------------------------------------------------------------------------+
| Grants for root@localhost                                                                      |
+------------------------------------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO root@localhost IDENTIFIED VIA unix_socket WITH GRANT OPTION |
| GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION                                  |
+------------------------------------------------------------------------------------------------+
2 rows in set (0.000 sec)


MariaDB [(none)]> SHOW CREATE USER 'root'@'localhost';
+-----------------------------------------------------------+
| CREATE USER for root@localhost                            |
+-----------------------------------------------------------+
| CREATE USER root@localhost IDENTIFIED VIA unix_socket |
+-----------------------------------------------------------+
1 row in set (0.000 sec)
Is there anything else that I also need to check, regarding what the current root access permissions are? Although it is a bit counter-intuitive compared to the old world, the MariaDB rationale for this change seems reasonable, and therefore I presume there is actually no real need for me to try to set a new DB root password any more (although we have changed the Linux root user password, for reasons related to those that are also prompting these changes). **Regarding changing passwords for other DB user accounts**, I am not sure whether I should be using the SET PASSWORD or ALTER USER commands? Do they both do effectively the same thing (as far as just changing passwords is involved (ALTER USER can obviously do more))? Is there a reason to use one of these commands rather than the other? Thanks for any advice.
dave559 (121 rep)
Jan 24, 2023, 09:00 PM
1 votes
1 answers
223 views
Backing-up Postgresql data when only root login is available (Ubuntu)
I have a Ubuntu-based workstation with several boot issues that prevent any user login - only logging in as "root" works. Before formatting the Ubuntu partition to perform a clean installation, I wanted to backup the users' Postgresql database data. However, since it is not possible to start PG clus...
I have a Ubuntu-based workstation with several boot issues that prevent any user login - only logging in as "root" works. Before formatting the Ubuntu partition to perform a clean installation, I wanted to backup the users' Postgresql database data. However, since it is not possible to start PG clusters as root, I cannot start databases as roots or log-in as PG user in root prompt. Question: is there a way I could backup PG database data in Ubuntu if only root login is available? Note that, fortunately or not, database data location was set to be a different partition from the OS installation.
Louis15 (113 rep)
Jan 19, 2023, 08:10 AM • Last activity: Jan 19, 2023, 08:39 AM
1 votes
1 answers
1243 views
MariaDB root password change using Ansible
I had tried to change MariaDB root password using following Ansible script. ``` - name: Dump MySQL root Password debug: msg: "MySQL new Password : {{ mysql_pass }}" - name: Set MySQL root Password become: True mysql_user: name=root host="localhost" password="{{ mysql_pass }}" check_implicit_admin=ye...
I had tried to change MariaDB root password using following Ansible script.
- name: Dump MySQL root Password
        debug:
          msg: "MySQL new Password : {{ mysql_pass }}"

      - name: Set MySQL root Password
        become: True
        mysql_user: 
          name=root
          host="localhost"
          password="{{ mysql_pass }}"
          check_implicit_admin=yes
          login_user="root"
          login_password=""
          state=present
In my /etc/ansible/hosts
[myhosts:vars]
mysql_pass=mynewpassword
As I was told password variable may not be taken, I added debug/msg step.
TASK [Dump MySQL root Password] ********************************************************************************************************************************
ok: [vizua@node1] => {
    "msg": "MySQL new Password : mynewpassword"
}
Similar issue discussed here . Thats where I got Password changing steps. This step runs without error, showing changed, but yet I can access without password or any password. MariaDB : Server version: 10.1.47-MariaDB-0ubuntu0.18.04.1 Ansible : ansible 2.5.1
Sachith Muhandiram (111 rep)
Dec 31, 2020, 11:40 AM • Last activity: Jan 18, 2022, 03:34 PM
0 votes
3 answers
1227 views
Supplying root password to MySQL V8 sort of fails
On Ubuntu 20.04 I have installed MySQL V8.0.25. But I kind of fail to apply a (valid) root password. The apt-get process for installing mysql-server did not ask for a root password. And I cannot enter mysql with the "mysql -u roor -p" command, I always do with "sudo mysql". So i first tried with the...
On Ubuntu 20.04 I have installed MySQL V8.0.25. But I kind of fail to apply a (valid) root password. The apt-get process for installing mysql-server did not ask for a root password. And I cannot enter mysql with the "mysql -u roor -p" command, I always do with "sudo mysql". So i first tried with the process described by this MySQL page . But this did not work at all, because V8 seems not to support the PASSWORD-function. So instead of running UPDATE mysql.user SET authentication_string = PASSWORD('MyNewPass'), password_expired = 'N' WHERE User = 'root' AND Host = 'localhost'; FLUSH PRIVILEGES; I used this: UPDATE mysql.user SET authentication_string = CONCAT('*', UPPER(SHA1(UNHEX(SHA1('MyNewPass'))))), password_expired = 'N' WHERE User = 'root' AND Host = 'localhost'; FLUSH PRIVILEGES; which I found described here . The query select host, user, authentication_string, password_expired from mysql.user; shows a nice table: +-----------+------------------+------------------------------------------------------------------------+-----------------------+ | host | user | authentication_string | plugin | +-----------+------------------+------------------------------------------------------------------------+-----------------------+ | % | joomla | $A$005$MF`6ea"OfH5v1kTuRW0zJS5MKk82btugdAz62uWe6QkxnrXtTLtx5M. | caching_sha2_password | | localhost | debian-sys-maint | $A$005$l%.r}2CBQT:+DV)a9S/UJUDJoFA8PhnCIE.E3zDFbBeUZ5vTrNSZpZDDv05 | caching_sha2_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 | s%nn69n9�NkFf7xoPdW/CCD/NjvLhTKXtx8gQmTX.RpIbOcHWsA. | caching_sha2_password | | localhost | root | mypass | auth_stock | +-----------+------------------+------------------------------------------------------------------------+-----------------------+ but still "mysql -u root -p" does not work with the suppiel password. I still get message: $ mysql -u root -p Enter password: ERROR 1698 (28000): Access denied for user 'root'@'localhost' I also tried this - without any success: UPDATE mysql.user SET authentication_string = 'mypass', password_expired = 'N', plugin = '' WHERE User = 'root' AND Host = 'localhost'; The ALTER cmd did not work neither ALTER USER 'root'@'localhost' IDENTIFIED BY 'oldpass'; ERROR 1396 (HY000): Operation ALTER USER failed for 'root'@'localhost' nor ALTER USER 'root'@'localhost' IDENTIFIED BY 'oldpass' REPLACE 'mypass'; ERROR 1396 (HY000): Operation ALTER USER failed for 'root'@'localhost' I spent now many hours in this and have no clue how to preceed. Any help is appreciated.
Ulrich (101 rep)
May 20, 2021, 07:28 AM • Last activity: May 22, 2021, 07:37 PM
0 votes
1 answers
43 views
How to change user privileges from 'Y' to 'N' in MySQL Server?
I want to change a privilege to my glpiuser from 'N' to 'Y'. In MySQL server, what is the command to do this task? [Here][1]'s the image that display my users. I'm using Ubuntu 20.04.1 [1]: https://i.sstatic.net/rgW0q.png
I want to change a privilege to my glpiuser from 'N' to 'Y'. In MySQL server, what is the command to do this task? Here's the image that display my users. I'm using Ubuntu 20.04.1
Taoufik Mourtadi
Apr 18, 2021, 01:56 AM • Last activity: Apr 19, 2021, 07:49 PM
1 votes
1 answers
118 views
Lost admin user ; Update not allowed on current user in MySQL
I work on MySQL. For making my database more secure I created new user and than deleted 'root' user which had all privileges. I think I did not give full privileges to new user. That's why it is giving error whenever I try to update a table in database. UPDATE command denied to user 'crm_user'@'loca...
I work on MySQL. For making my database more secure I created new user and than deleted 'root' user which had all privileges. I think I did not give full privileges to new user. That's why it is giving error whenever I try to update a table in database. UPDATE command denied to user 'crm_user'@'localhost' for table In case I lost the superuser (in my case it was root) how can I retrieve or get all privileges to get control on my DB. DB is installed on my VPS so I have full control whatever need to do but I have no idea what to do. Please help. Thanks
Danish (11 rep)
Jan 3, 2021, 09:30 AM • Last activity: Jan 3, 2021, 10:05 AM
0 votes
1 answers
699 views
Do I have to worry that root user can login into MariaDB 10.5 without password
I remember when installing MySQL Server 8.0, or in some database setups, there are warnings about no password login. Should I worry about this? I think if someone gets access to `root` user on my `debian` they can reset root password of MariaDB. What is the real answer here? I appreciate doc referen...
I remember when installing MySQL Server 8.0, or in some database setups, there are warnings about no password login. Should I worry about this? I think if someone gets access to root user on my debian they can reset root password of MariaDB. What is the real answer here? I appreciate doc reference.
Ehsan88 (101 rep)
Nov 29, 2020, 04:17 PM • Last activity: Nov 29, 2020, 04:26 PM
0 votes
0 answers
49 views
Deleted MySQL “root” user in phpMyAdmin through XAMPP local host…how to restore?
I was working in phpMyAdmin (XAMPP localhost) to add a user for a new database I created for a local WordPress website, and came upon the list of users named "root". Since I did not remember ever creating these root users, I tried to delete them. I don't know what I clicked. I don't remember hitting...
I was working in phpMyAdmin (XAMPP localhost) to add a user for a new database I created for a local WordPress website, and came upon the list of users named "root". Since I did not remember ever creating these root users, I tried to delete them. I don't know what I clicked. I don't remember hitting any delete button, but this resulted in deletion of root. After that, all my databases were gone along with all users. Now only "Database operations information_schema" is there in phpMyAdmin panel. Now when I click on the "Databases" tab in phpMyAdmin, it simply returns a red warning "No privileges to create databases". There's no user tab. I can still see my databases in MySQL folder in XAMPP folder, and all WordPress websites work fine. But I am unable to create a new database/user nor am I seeing my existing databases. I searched google, and found a similar query here with a solution. https://dba.stackexchange.com/questions/124871/deleted-mysql-root-user-using-phpmyadmin-how-to-restore However, I tried most of the steps in the solution, but nothing came up. Could anyone please help me with a solution to add root user as well as databases back in phpMyAdmin using XAMPP localhost? I'm a novice, so need step-by-step instructions please. Your help will be greatly appreciated. Thank you!
TWyPGn (1 rep)
Sep 10, 2020, 01:45 PM
1 votes
1 answers
159 views
Should I revoke login from the default pgsql user?
I set up a localhost pgsql installation (os x catalina, homebrew, 12.*). I am developing a sql data warehouse and I’d like my dev environment to be as close to the production one as possible. Homebrew created a default superuser, chris. Is it ok (and possible) to revoke the login attribute from this...
I set up a localhost pgsql installation (os x catalina, homebrew, 12.*). I am developing a sql data warehouse and I’d like my dev environment to be as close to the production one as possible. Homebrew created a default superuser, chris. Is it ok (and possible) to revoke the login attribute from this user? I have set up dedicated users to interact with the data warehouse and the actual data in the system. Thanks!
Chris (185 rep)
Jul 5, 2020, 09:18 PM • Last activity: Jul 6, 2020, 06:16 AM
0 votes
0 answers
708 views
Syntax error when update root password
I forgot MySQL root password so I am trying to change it by starting it in safe mode and running following command but getting syntax error. MySQL version is 8. What is the correct syntax to update password? Or is it happening due to presence of $ and @ in password? UPDATE mysql.user SET Password=PA...
I forgot MySQL root password so I am trying to change it by starting it in safe mode and running following command but getting syntax error. MySQL version is 8. What is the correct syntax to update password? Or is it happening due to presence of $ and @ in password? UPDATE mysql.user SET Password=PASSWORD('$kjD q6 MM paSSword@') WHERE User='root';
Frank Martin (451 rep)
May 21, 2020, 04:29 PM
Showing page 1 of 16 total questions