I did the following to set password restrictions for my users on MariaDB.
ALTER USER 'User Name' FAILED_LOGIN_ATTEMPTS 3 PASSWORD_LOCK_TIME 3;
But I get the following error and cannot do it.
Why is this?
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'FAILED_LOGIN_ATTEMPTS 3 PASSWORD_LOCK_TIME 3' at line 1
As mentioned in the comments, MariaDB does not have this feature.
Related
In MySQL you can make logging appear in JSON format by installing component_log_sink_json component and enabling this component:
INSTALL COMPONENT 'file://component_log_sink_json';
SET PERSIST log_error_services = 'log_filter_internal; log_sink_json';
Source: https://dev.mysql.com/doc/refman/8.0/en/error-log-json.html
But this does not work in MariaDB:
MariaDB > INSTALL COMPONENT 'file://component_log_sink_json';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'COMPONENT 'file://component_log_sink_json'' at line 1
MariaDB > SET log_error_services = 'log_filter_internal; log_sink_json';
ERROR 1193 (HY000): Unknown system variable 'log_error_services'
How can I make MariaDB log in JSON format?
I am trying make user via CLI: (symfony doc)
php bin/console make:user
This command create User.php entity which implements UserInterface.
But after command:
php bin/console doctrine:schema:update --force
I get errors:
In AbstractMySQLDriver.php line 79:
An exception occurred while executing 'CREATE TABLE user (id INT AUTO_INCREMENT NOT NULL, email VARCHAR(18
0) NOT NULL, roles JSON NOT NULL, password VARCHAR(255) NOT NULL, UNIQUE INDEX UNIQ_8D93D649E7927C74 (emai
l), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB':
SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the ma
nual that corresponds to your MariaDB server version for the right syntax to use near 'JSON NOT NULL, pass
word VARCHAR(255) NOT NULL, UNIQUE INDEX UNIQ_8D93D649E7927C7' at line 1
In PDOConnection.php line 90:
SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the ma
nual that corresponds to your MariaDB server version for the right syntax to use near 'JSON NOT NULL, pass
word VARCHAR(255) NOT NULL, UNIQUE INDEX UNIQ_8D93D649E7927C7' at line 1
In PDOConnection.php line 88:
SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the ma
nual that corresponds to your MariaDB server version for the right syntax to use near 'JSON NOT NULL, pass
word VARCHAR(255) NOT NULL, UNIQUE INDEX UNIQ_8D93D649E7927C7' at line 1
EDIT:
Info about sql:
Server type: MariaDB
Server version: 10.1.31-MariaDB - mariadb.org binary distribution
Protocol version: 10
Your MariaDB has to be updated. You have a field with type=JSON (e.g. roles), but that is only available from 10.2+, you have version 10.1.
Also, the method you're using (update+ --force) isn't very Symfony 4. A better aproach would be:
php bin/console make:user
php bin/console make:migration
php bin/console doctrine:migrations:migrate
JSON Type is an unknown type for your MariaDB database version (cf type documentation). Doctrine creates a bad migration script, because it didn't know which version you're using.
Configure server_version in config/packages/doctrine.yml to:
doctrine:
dbal:
# configure these for your database server
driver: 'pdo_mysql'
server_version: 'XXXX'
...
Replace X by your version, prefixed by mariadb- as mentioned in documentation. So DoctrineBundle will know that JSON is not supported and will replace by another type.
When i run comand php bin/console doctrine:migration:migrate i got this error I don't know where is come from.
command line error :
In AbstractMySQLDriver.php line 99:
An exception occurred while executing 'CREATE TABLE user (id INT AUTO_INCREMENT NOT NULL, email VARCHAR(180) NOT NU
LL, roles JSON NOT NULL, password VARCHAR(255) NOT NULL, UNIQUE INDEX UNIQ_8D93D649E7927C74 (email), PRIMARY KEY(id
)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE = InnoDB':
SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that
corresponds to your MariaDB server version for the right syntax to use near 'JSON NOT NULL, password VARCHAR(255)
NOT NULL, UNIQUE INDEX UNIQ_8D93D649E7927C7' at line 1
In PDOConnection.php line 109:
SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that
corresponds to your MariaDB server version for the right syntax to use near 'JSON NOT NULL, password VARCHAR(255)
NOT NULL, UNIQUE INDEX UNIQ_8D93D649E7927C7' at line 1
In PDOConnection.php line 107:
SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that
corresponds to your MariaDB server version for the right syntax to use near 'JSON NOT NULL, password VARCHAR(255)
NOT NULL, UNIQUE INDEX UNIQ_8D93D649E7927C7' at line 1
My env
my env
Andrei is right. You either have to upgrade your database or (much easier) config your symfony to use the lower Version of MySQL.
config/packages/doctrine.yaml
doctrine:
dbal:
# configure these for your database server
driver: 'pdo_mysql'
server_version: '5.6'
here you can find a table with the compatibilitys of MySQL and MariaDB.
Update your MySQL's version to MySQL 5.7.
Because your current version does not support MySQL 5.7's JSON objects.
In this case you can simply paste this code in config/packages/doctrine.yaml :
doctrine:
dbal:
# configure these for your database server
driver: 'pdo_mysql'
server_version: '5.5'
Please note that the version information can conflict with the one defined in the database URL
If you added the server version information to the doctrine.yaml and the problem persisted, try checking "serverVersion" at the end if your database URL and set it to 5.6 or the compatible vresion you found
Does MARIADB support TableSpaces ? I want to know can I create table spaces in MARIA DB - as they allow to use INNODB .
What do you get from SELECT * FROM information_schema.INNODB_SYS_TABLESPACES? See https://mariadb.com/kb/en/mariadb/information-schema-tablespaces-table/ "starting with MariaDB 5.5". However: "The table is a MariaDB and MySQL extension, and does not include information about InnoDB tablespaces."
Why are you hoping for tablespaces?
I would like to read an external file into MariaDB using the CONNECT engine. However, when trying to read from the file, I get an error message:
MariaDB [test]> create table test ( name varchar(100), team varchar(100) ) engine=CONNECT table_type=CSV file_name='/tmp/data.csv' header=1 sep_char=',' quoted=0;
Query OK, 0 rows affected (0.24 sec)
MariaDB [test]> select * from test;
ERROR 1296 (HY000): Got error 174 'Open() error 13 on /tmp/data.csv: Permission denied' from CONNECT
Checking the filesystem permissions gives me:
divingt#grisu ~ $ ls -l /tmp/data.csv
-rw-rw-rw- 1 divingt divingt 1658 Dec 31 13:59 /tmp/data.csv
So everybody should be able to read and write from the file.
Also in MYSQL the permissions allow for everything:
MariaDB [test]> SHOW GRANTS;
+------------------------------------------------------------------------------------------------+
| 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.00 sec)
I run a Linux Mint system.
Thanks a lot for any help.
It turns out that the reason was that apparmor prevented mysqld from reading from reading the file. Disabling it (or changing the permissions) solved the problem.