В MySQL есть временами непонятные ограничения, которые не позволяют привычным нам образом его использовать. Однако, если разобраться, то всё начинает иметь смысл.
Очевидно, что смена пароля супер-пользователя должна быть особо безопасной,
чтобы случайно кто-то не смог получить прав, с которыми он может натворить
много бед. Так что обычный UPDATE
нам не подходит:
mysql> UPDATE mysql.user SET Password=PASSWORD('s3cr3t') WHERE User='root';
ERROR 1348 (HY000): Column 'Password' is not updatable
Поэтому нам нужна команда, которая на которую можно настроить иные привелегии,
ведь право обновления значений в таблице mysql.user
может быть и у других
пользователей, обслуживающих данный сервер. С другой стороны обновлять
структуру таблицы mysql.user
обычно не надо, более того – это довольно
важное и ответственное действие. Поэтому именно изменением таблицы или же
ALTER
-ом можно изменить пароль пользователя root.
ALTER USER 'root'@'localhost' IDENTIFIED BY 's3cr3t';
После чего не забываем обновить привелегии на нашем MySQL или MariaDB сервере:
flush privileges;
Вот так занятно придумали разработчики MySQL/MariaDB решить вопрос
с правами на смену пароля root-а.
MySQL and MariaDB password |
As already mentioned in the title of this blog, this error message sometimes occurred when we are trying to update our root password database, either MySQL or MariaDB, The error says:
ERROR 1348 (HY000): Column 'Password' is not updatable
This is because if we use this SQL command to update our database root password, and it turn out to be Restricted by MySQL to use update on mysql database.
UPDATE mysql.user SET Password=PASSWORD('1234') WHERE User='root';
The solutions for MySQL Error1348
So you can not update a user password using Update commands, to update the password, use ALTER commands instead. like the following.
ALTER USER 'root'@'localhost' IDENTIFIED BY '1234';
And then you need to do the flush privileges to commit previous queries (that alter command above) into the system, simply do like this.
flush privileges;
So now you have your root with password 1234. Although it is recommended to use much more stronger unpredictable password. Never use 1234 as password of any of your login credentials, unless it is just for testing.
So I’ve been using MySQL since the beginning of my software development carrier. Still, i got trouble memorizing some SQL commands, to as simple as updating mysql user password, i can do that without looking to this blog for reference. So this blog is become my public note book.
Not only changing root password, you can also change any other MySQL user in your database using Alter command, don’t using Update.
Update is more to updating our own database, not MySQL system database like database named mysql, it is in fact an auto generated MySQL default database. It is used for storing list of eligible users, MySQL system configuration, languages, etc.
MySQL or MariaDB is one of My favorite relational database system (RDMS) for either developing or even i use it for my production services.
Mysql is a large enterprise database system that is proven to be capable of handling so many database transactions in many big companies’ big production data centers.
It is easier to install MySQL and to manage it than any other competitor database system out there. It make my application development so much fast, and also stable in our production application.
I love MySQL, it is fast, and using SQL dialect that lot of peoples use, so in case i got trouble with some SQL commands to do something, just by searching online on Google I can find the solution right away.
You can do from simple SQL queries, to advanced complex queries, MySQL can handle that, fast and reliable.
I think MySQL probably the perfect free database system in the world, even it is free but it is been proven to be the right choice for many start up or even big companies out there.
Although there’s several cons, MySQL still evolved and improve their system to be better and better.
I’ve got 3 identical server, that throw the same error when trying to restore a user backup or edit a MySQL password.
No idea where to look, anyone familiar with this error, or can point me to a direction to look?
Column ‘Password’ is not updatable
CentOs 8
Latest version of DirectAdmin: 1.61.3
Installed version of DirectAdmin: 1.61.3
Latest version of LetsEncrypt: 2.0.7
Installed version of LetsEncrypt: 2.0.7
Latest version of CustomBuild plugin: 1.0.34
Installed version of CustomBuild plugin: 1.0.34
Latest version of Apache: 2.4.43
Installed version of Apache: 2.4.43
Latest version of Pure-FTPD: 1.0.49
Installed version of Pure-FTPd: 1.0.49
Latest version of libpng: 1.6.37
Installed version of libpng: 1.6.37
Latest version of libwebp: 1.1.0
Installed version of libwebp: 1.1.0
Latest version of nghttp2: 1.41.0
Installed version of nghttp2: 1.41.0
Latest version of libjpeg: 9d
Installed version of libjpeg: 9d
Latest version of ICU4C: 66.1
Installed version of ICU4C: 66.1
Latest version of libsodium: 1.0.18
Installed version of libsodium: 1.0.18
Latest version of libxml2: 2.9.9
Installed version of libxml2: 2.9.9
Latest version of libxslt: 1.1.33
Installed version of libxslt: 1.1.33
Latest version of iconv: 1.16
Installed version of iconv: 1.16
Latest version of PCRE: 8.20
Installed version of PCRE: 8.20
Latest version of PCRE2: 10.35
Installed version of PCRE2: 10.35
Latest version of FreeType: 2.10.1
Installed version of FreeType: 2.10.1
Latest version of dovecot: 2.3.10.1
Installed version of dovecot: 2.3.10.1
Latest version of dovecot.conf: 0.4
Installed version of dovecot.conf: 0.4
Latest version of lego: 3.8.0
Installed version of lego: 3.8.0
Latest version of s-nail: 14.9.19
Installed version of s-nail: 14.9.19
Latest version of SpamAssassin: 3.4.4
Installed version of SpamAssassin: 3.4.4
Latest version of zstd: 1.4.5
Installed version of zstd: 1.4.5
Latest version of MariaDB: 10.4.13
Installed version of MariaDB: 10.4.13
Latest version of PHP 5.6: 5.6.40
Installed version of PHP 5.6: 5.6.40
Latest version of PHP 7.4: 7.4.8
Installed version of PHP 7.4: 7.4.8
Latest version of RoundCube: 1.4.7
Installed version of RoundCube: 1.4.7
Latest version of phpMyAdmin: 5.0.2-all-languages
Installed version of phpMyAdmin: 5.0.2-all-languages
DirectAdmin Error Log
2020:07:30-22:38:44: Database::alter_user (raw=0, mysql_use_new_user_methods=0): error altering ‘testtest_test’: Column ‘Password’ is not updatable
2020:07:30-22:38:44:query: UPDATE mysql.user SET password=PASSWORD(‘xxxxxxxx’) WHERE user=’testtest_test’ AND host=’localhost’
Pages 1
You must login or register to post a reply
1 2020-03-21 06:10:18
- rogwynn
- Member
- Offline
- Registered: 2020-03-09
- Posts: 6
Topic: MariaDB 10.4 not creating iRedMail databases
==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
— iRedMail version (check /etc/iredmail-release): 1.1
— Deployed with iRedMail Easy or the downloadable installer? downloadable installer
— Linux/BSD distribution name and version: FreeBSD 12.1
— Store mail accounts in which backend (LDAP/MySQL/PGSQL): LDAP
— Web server (Apache or Nginx): Nginx
— Manage mail accounts with iRedAdmin-Pro? No
— [IMPORTANT] Related original log or error message is required if you’re experiencing an issue.
====
Brought over from the 1.1 Release Announcement:
Due to the way MariaDB 10.4 changed how the root account accesses the database, and how MariaDB stores users (mysql.user is now a view of mysql.global_priv), changing the root password in functions/mysql.sh doesn’t work:
# MySQL 5.7
ECHO_DEBUG "Setting password for MySQL root user: ${MYSQL_ROOT_USER}
."
#if [ X"${LOCAL_ADDRESS}" == X'127.0.0.1' ]; then
# # Get initial random root password from /root/.mysql-secret
# export _mysql_root_pw="$(tail -1 /root/.mysql_secret)"
# mysqladmin -h ${MYSQL_SERVER_ADDRESS} -u${MYSQL_ROOT_USER} -p${
_mysql_root_pw} password ${MYSQL_ROOT_PASSWD} >> ${INSTALL_LOG} 2>&1
#else
# # Jail
mysql -h ${MYSQL_SERVER_ADDRESS} -u${MYSQL_ROOT_USER} --connect-
expired-password mysql -e "UPDATE user SET host='${LOCAL_ADDRESS}',authenticatio
n_string=PASSWORD('${MYSQL_ROOT_PASSWD}'),password_expired='N' WHERE User='root'
AND Host='localhost'; FLUSH PRIVILEGES;" >> ${INSTALL_LOG} 2>&1
# The above code doesn't work anymore, root has to connect via socket
Here’s the relevant error from runtime/install.log (ERROR 1348 (HY000) at line 1: Column ‘authentication_string’ is not updatable:
[ INFO ] Configure MariaDB database server.
+ < DEBUG > Initialize MySQL server.
+ < DEBUG > Stop MySQL service before initializing database or updating my.cnf.
+ < DEBUG > Enable mysql service when system start up.
mysql_enable: -> YES
mysql_optfile: -> /var/db/mysql/my.cnf
+ < DEBUG > Copy sample MySQL config file: /usr/local/share/mysql/my-large.cnf
-> /var/db/mysql/my.cnf.
+ < DEBUG > Disable 'skip-networking' in my.cnf.
+ < DEBUG > Set max_connections to 1024.
+ < DEBUG > Enable 'skip_grant_tables' option, so that we can reset password.
+ < DEBUG > Enable 'bind-address = 192.168.0.3' in my.cnf.
+ < DEBUG > Restart service: mysql-server.
mysql not running? (check /var/db/mysql/mx.peakbias.com.pid).
2020-03-20 21:33:20 0 [Warning] WSREP: Failed to guess base node address. Set it
explicitly via wsrep_node_address.
2020-03-20 21:33:20 0 [Warning] WSREP: Failed to guess base node address. Set it
explicitly via wsrep_node_address.
2020-03-20 21:33:20 0 [Warning] WSREP: Guessing address for incoming client conn
ections failed. Try setting wsrep_node_incoming_address explicitly.
+ < DEBUG > Sleep 10 seconds for MySQL daemon initialization ...
+ < DEBUG > Setting password for MySQL root user: root.
ERROR 1348 (HY000) at line 1: Column 'authentication_string' is not updatable
+ < DEBUG > Remove 'skip_grant_tables'.
+ < DEBUG > Restart service: mysql-server.
+ < DEBUG > Sleep 10 seconds for MySQL daemon initialization ...
+ < DEBUG > Generate defauts file for MySQL client option --defaults-file: /roo
t/.my.cnf.
+ < DEBUG > Delete anonymous database user.
As root I connected to the MariaDB server, via localhost, and you can see no databases were created.
[root@mx ~]# mysql
ERROR 1130 (HY000): Host '192.168.0.3' is not allowed to connect to this MariaDB server
[root@mx ~]# mysql -h localhost
Welcome to the MariaDB monitor. Commands end with ; or g.
Your MariaDB connection id is 64
Server version: 10.4.12-MariaDB FreeBSD Ports
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
MariaDB [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| test |
+--------------------+
4 rows in set (0.003 sec)
MariaDB [(none)]>
In my previous install, I installed MariaDB 10.4 in a separate jail and used the «install with remote MySQL» instructions. This worked. Here I’m installing on another host, and I wanted to make a proper post and not muddy up the 1.1 announcement thread.
As suggested I will try again with the master branch from GitHub and will update this thread on how it goes.
—-
Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Stable release is out.
2 Reply by rogwynn 2020-03-23 04:06:59
- rogwynn
- Member
- Offline
- Registered: 2020-03-09
- Posts: 6
Re: MariaDB 10.4 not creating iRedMail databases
Well, install from master branch didn’t work but not because of MariaDB, just ports weirdness:
===> Checking if dbus-glib is already installed
===> Registering installation for dbus-glib-0.110 as automatic
pkg-static: Cannot get an exclusive lock on a database, it is locked by another process
*** Error code 75
Stop.
make[3]: stopped in /basejail/usr/ports/devel/dbus-glib
*** Error code 1
Stop.
make[2]: stopped in /basejail/usr/ports/net/avahi-app
*** Error code 1
Stop.
make[1]: stopped in /basejail/usr/ports/lang/gnustep-base
*** Error code 1
Stop.
make: stopped in /basejail/usr/ports/devel/sope4
<< ERROR >> Port was not successfully installed, please fix it manually and then re-execute this script.
3 Reply by ZhangHuangbin 2020-03-24 10:14:23
- ZhangHuangbin
- iRedMail Developers
- Offline
- Registered: 2009-05-06
- Posts: 30,080
Re: MariaDB 10.4 not creating iRedMail databases
rogwynn wrote:
pkg-static: Cannot get an exclusive lock on a database, it is locked by another process
— Did you modify «functions/packages_freebsd.sh» to build/install ports concurrently?
— Does re-running iRedMail installer trigger this issue again?
4 Reply by rogwynn 2020-03-31 21:53:53
- rogwynn
- Member
- Offline
- Registered: 2020-03-09
- Posts: 6
Re: MariaDB 10.4 not creating iRedMail databases
ZhangHuangbin wrote:
rogwynn wrote:
pkg-static: Cannot get an exclusive lock on a database, it is locked by another process
— Did you modify «functions/packages_freebsd.sh» to build/install ports concurrently?
— Does re-running iRedMail installer trigger this issue again?
I didn’t modify «functions/packages_freebsd.sh».
I didn’t re-run the installer again, but today I ran a fresh install on a new jail from the master branch. The previous error «pkg-static: Cannot get an exclusive lock on a database, it is locked by another process» did not appear, but the MariaDB problem is still there.
[ INFO ] Configure MariaDB database server.
+ < DEBUG > Initialize MySQL server.
+ < DEBUG > Stop MySQL service before initializing database or updating my.cnf.
+ < DEBUG > Enable mysql service when system start up.
mysql_enable: -> YES
mysql_optfile: -> /var/db/mysql/my.cnf
+ < DEBUG > Copy sample MySQL config file: /usr/local/share/mysql/my-large.cnf
-> /var/db/mysql/my.cnf.
+ < DEBUG > Disable 'skip-networking' in my.cnf.
+ < DEBUG > Set max_connections to 1024.
+ < DEBUG > Enable 'skip_grant_tables' option, so that we can reset password.
+ < DEBUG > Enable 'bind-address = 192.168.0.3' in my.cnf.
+ < DEBUG > Restart service: mysql-server.
mysql not running? (check /var/db/mysql/mx.DOMAIN.com.pid).
2020-03-30 20:36:30 0 [Warning] WSREP: Failed to guess base node address. Set it
explicitly via wsrep_node_address.
2020-03-30 20:36:30 0 [Warning] WSREP: Failed to guess base node address. Set it
explicitly via wsrep_node_address.
2020-03-30 20:36:30 0 [Warning] WSREP: Guessing address for incoming client conn
ections failed. Try setting wsrep_node_incoming_address explicitly.
+ < DEBUG > Sleep 10 seconds for MySQL daemon initialization ...
+ < DEBUG > Setting password for MySQL root user: root.
ERROR 1348 (HY000) at line 1: Column 'authentication_string' is not updatable
+ < DEBUG > Remove 'skip_grant_tables'.
+ < DEBUG > Restart service: mysql-server.
+ < DEBUG > Sleep 10 seconds for MySQL daemon initialization ...
+ < DEBUG > Generate defauts file for MySQL client option --defaults-file: /roo
t/.my.cnf.
+ < DEBUG > Delete anonymous database user.
I decided to install MariaDB 10.4 in the jail before running the install script. I set up a user/password and used the remote MySQL instructions to install. The install fails because it tries to install MariaDB anyway. I checked the «functions/packages_freebsd.sh» script, and it shows this:
if [ X"${BACKEND}" == X'OPENLDAP' ]; then
ALL_PORTS="${ALL_PORTS} net/openldap${PREFERRED_OPENLDAP_VER}-sasl-client net/openldap${PREFERRED_OPENLDAP_VER}-server"
ALL_PORTS="${ALL_PORTS} databases/mariadb${PREFERRED_MARIADB_VER}-server"
elif [ X"${BACKEND}" == X'MYSQL' ]; then
# Install client before server.
ALL_PORTS="${ALL_PORTS} databases/mariadb${PREFERRED_MARIADB_VER}-client"
if [ X"${USE_EXISTING_MYSQL}" != X'YES' ]; then
ALL_PORTS="${ALL_PORTS} databases/mariadb${PREFERRED_MARIADB_VER}-server"
fi
elif [ X"${BACKEND}" == X'PGSQL' ]; then
ALL_PORTS="${ALL_PORTS} databases/postgresql${PGSQL_VERSION}-server databases/postgresql${PGSQL_VERSION}-contrib"
fi
Since I’m using the OpenLDAP backend, it adds the MariaDB to the package list. USE_EXISTING_MYSQL=YES doesn’t mean anything in this case. I changed the script to also check in the «X»${BACKEND}» == X’OPENLDAP’ » block to check for USE_EXISTING_MYSQL:
if [ X"${BACKEND}" == X'OPENLDAP' ]; then
ALL_PORTS="${ALL_PORTS} net/openldap${PREFERRED_OPENLDAP_VER}-sasl-client net/openldap${PREFERRED_OPENLDAP_VER}-server"
if [ X"${USE_EXISTING_MYSQL}" != X'YES' ]; then
ALL_PORTS="${ALL_PORTS} databases/mariadb${PREFERRED_MARIADB_VER}-server"
fi
elif [ X"${BACKEND}" == X'MYSQL' ]; then
5 Reply by ZhangHuangbin 2020-04-01 11:20:40
- ZhangHuangbin
- iRedMail Developers
- Offline
- Registered: 2009-05-06
- Posts: 30,080
Re: MariaDB 10.4 not creating iRedMail databases
I can not reproduce this issue with the latest iRedMail development edition.
Anyway to give me ssh access to try this deployment for debugging purpose?
6 Reply by GenZod 2021-07-30 01:34:39
- GenZod
- Member
- Offline
- Registered: 2019-02-19
- Posts: 17
Re: MariaDB 10.4 not creating iRedMail databases
Hi Zhang, I’ve mentioned this in the Telegram group but will post it here as well. I’m having similar issues as this on a fresh install on FreeBSD 12.2 amd64 using 1.4.0 MARIADB edition.
The installation went well and installed everything except the db is empty, similar to OP’s. So is there a script or scripts to re-create the necessary databases again ?
7 Reply by ZhangHuangbin 2021-07-30 11:26:47
- ZhangHuangbin
- iRedMail Developers
- Offline
- Registered: 2009-05-06
- Posts: 30,080
Re: MariaDB 10.4 not creating iRedMail databases
GenZod wrote:
The installation went well and installed everything except the db is empty
Looks like MariaDB was not correctly setup and running, please check console output and file «runtime/install.log» for more details.
GenZod wrote:
So is there a script or scripts to re-create the necessary databases again ?
No.
8 Reply by GenZod 2021-07-30 19:07:46
- GenZod
- Member
- Offline
- Registered: 2019-02-19
- Posts: 17
Re: MariaDB 10.4 not creating iRedMail databases
I got the database up and running. However it’s still empty after re-running the install script. Where are the .sql files stored so I can just it to re-create the missing databases ?
9 Reply by ZhangHuangbin 2021-08-02 09:59:11
- ZhangHuangbin
- iRedMail Developers
- Offline
- Registered: 2009-05-06
- Posts: 30,080
Re: MariaDB 10.4 not creating iRedMail databases
GenZod wrote:
I got the database up and running. However it’s still empty after re-running the install script.
Looks like MariaDB was not correctly setup and running, please check console output and file «runtime/install.log» for more details.
We need to figure out why MariaDB was not running or not correctly set root password.
Pages 1
You must login or register to post a reply