GOAL:
I am trying to run mysql on my work servers machines. But as admins did not install it in the usual default installation path, it fails. How can I make it works?
FACTS:
MySQL is installed under: /opt/mysql/10.1.16/
$> ls -1 /opt/mysql/10.1.16/
bin
COPYING
COPYING.LESSER
COPYING.thirdparty
CREDITS
data
EXCEPTIONS-CLIENT
include
INSTALL-BINARY
lib
man
mysql-test
README
README-wsrep
scripts
share
sql-bench
support-files
However, when I want to run mysql from a script, I do:
export LIBMYSQL_PLUGIN_DIR="/opt/mysql/10.1.16/lib/plugin"
export LD_LIBRARY_PATH="/opt/mysql/10.1.16/lib"
export LD_RUN_PATH="/opt/mysql/10.1.16/lib"
export PATH="/opt/mysql/10.1.16/bin:/home/xxxxxxxx/bin:/usr/local/bin:/usr/bin:/bin:/usr/lib64/jvm/jre/bin:/usr/lib/mit/bin:/usr/lib/mit/sbin"
/opt/mysql/10.1.16/bin/mysql -C --no-beep --line-numbers --protocol=TCP --host="${DB_HOSTNAME}" --port="${DB_PORT}" --user="${DB_USER}" --database "${DB_SCHEMA}" -o --delimiter ','
With all my DB_xxxx corectly set, I get the following error:
ERROR 2059 (HY000): Authentication plugin 'dialog' cannot be loaded: /usr/local/mysql/lib/plugin/dialog.so: cannot open shared object file: No such file or directory
I checked the official documentation page:
https://dev.mysql.com/doc/refman/8.0/en/environment-variables.html and the only mention about plugin is to check if LIBMYSQL_PLUGIN_DIR, which seems good since:
$> echo "${LIBMYSQL_PLUGIN_DIR}"
/opt/mysql/10.1.16/lib/plugin
$> ls -la /opt/mysql/10.1.16/lib/plugin
-rwxr-xr-x 1 mysql dba 17382 Sep 13 2016 adt_null.so
-rwxr-xr-x 1 mysql dba 12462 Sep 13 2016 auth_0x0100.so
-rwxr-xr-x 1 mysql dba 33039 Sep 13 2016 auth_gssapi_client.so
-rwxr-xr-x 1 mysql dba 80774 Sep 13 2016 auth_gssapi.so
-rwxr-xr-x 1 mysql dba 18007 Sep 13 2016 auth_pam.so
-rwxr-xr-x 1 mysql dba 13028 Sep 13 2016 auth_socket.so
-rwxr-xr-x 1 mysql dba 23521 Sep 13 2016 auth_test_plugin.so
-rw-r--r-- 1 mysql dba 227 Sep 13 2016 daemon_example.ini
-rwxr-xr-x 1 mysql dba 15267 Sep 13 2016 debug_key_management.so
-rwxr-xr-x 1 mysql dba 14975 Sep 13 2016 dialog_examples.so
-rwxr-xr-x 1 mysql dba 39102 Sep 13 2016 dialog.so
-rwxr-xr-x 1 mysql dba 35337 Sep 13 2016 example_key_management.so
-rwxr-xr-x 1 mysql dba 67516 Sep 13 2016 file_key_management.so
-rwxr-xr-x 1 mysql dba 534847 Sep 13 2016 ha_archive.so
-rwxr-xr-x 1 mysql dba 326244 Sep 13 2016 ha_blackhole.so
-rwxr-xr-x 1 mysql dba 6315641 Sep 13 2016 ha_connect.so
-rwxr-xr-x 1 mysql dba 270829 Sep 13 2016 ha_example.so
-rwxr-xr-x 1 mysql dba 408688 Sep 13 2016 ha_federated.so
-rwxr-xr-x 1 mysql dba 658050 Sep 13 2016 ha_federatedx.so
-rwxr-xr-x 1 mysql dba 17067973 Sep 13 2016 ha_innodb.so
-rwxr-xr-x 1 mysql dba 13007344 Sep 13 2016 ha_mroonga.so
-rwxr-xr-x 1 mysql dba 1586135 Sep 13 2016 handlersocket.so
-rwxr-xr-x 1 mysql dba 1687004 Sep 13 2016 ha_oqgraph.so
-rwxr-xr-x 1 mysql dba 745005 Sep 13 2016 ha_sphinx.so
-rwxr-xr-x 1 mysql dba 5150095 Sep 13 2016 ha_spider.so
-rwxr-xr-x 1 mysql dba 226800 Sep 13 2016 ha_test_sql_discovery.so
-rwxr-xr-x 1 mysql dba 35898 Sep 13 2016 libdaemon_example.so
-rwxr-xr-x 1 mysql dba 131020 Sep 13 2016 locales.so
-rwxr-xr-x 1 mysql dba 221483 Sep 13 2016 metadata_lock_info.so
-rwxr-xr-x 1 mysql dba 18211 Sep 13 2016 mypluglib.so
-rwxr-xr-x 1 mysql dba 16382 Sep 13 2016 mysql_clear_password.so
-rwxr-xr-x 1 mysql dba 18751 Sep 13 2016 qa_auth_client.so
-rwxr-xr-x 1 mysql dba 24478 Sep 13 2016 qa_auth_interface.so
-rwxr-xr-x 1 mysql dba 13542 Sep 13 2016 qa_auth_server.so
-rwxr-xr-x 1 mysql dba 229059 Sep 13 2016 query_cache_info.so
-rwxr-xr-x 1 mysql dba 286720 Sep 13 2016 query_response_time.so
-rwxr-xr-x 1 mysql dba 534415 Sep 13 2016 semisync_master.so
-rwxr-xr-x 1 mysql dba 445144 Sep 13 2016 semisync_slave.so
-rwxr-xr-x 1 mysql dba 175928 Sep 13 2016 server_audit.so
-rwxr-xr-x 1 mysql dba 32295 Sep 13 2016 simple_password_check.so
-rwxr-xr-x 1 mysql dba 19846 Sep 13 2016 sql_errlog.so
-rwxr-xr-x 1 mysql dba 218688 Sep 13 2016 wsrep_info.so
All libraries have execution rights, they are all here BUT MYSQL is still trying to search in the default path /usr/local/mysql/lib/plugin/. And of course on our machine, this path does not exist.
QUESTION:
Is there another option/way to specifically ask mysql to load plugin for a specific directory?
NOTES:
I found some links about the error ERROR 2059 (HY000): Authentication plugin 'dialog' cannot be loaded: /usr/local/mysql/lib/plugin/dialog.so: cannot open shared object file: No such file or directory but solutions are all:
Uninstall mysql and install it again (which I can't)
Create the directory or symlink (I can't neither)
Use the --enable-cleartext-plugin option (it does nothing and I don't think it is related in my case)
So I think I understood why.
Setting LIBMYSQL_PLUGIN_DIR:
export LIBMYSQL_PLUGIN_DIR="/opt/mysql/10.1.16/lib/plugin"
is somehow not read or taken in account.
However, adding directly to the binary the option --plugin-dir="${LIBMYSQL_PLUGIN_DIR}" will make it work.
So correct answer is:
/opt/mysql/10.1.16/bin/mysql --plugin-dir="${LIBMYSQL_PLUGIN_DIR}" -C --no-beep --line-numbers --protocol=TCP --host="${DB_HOSTNAME}" --port="${DB_PORT}" --user="${DB_USER}" --database "${DB_SCHEMA}" -o --delimiter ','
Why the env varibale is not read, that is a mystery
Related
i find lot's of ibd file in my mysql server datadir ,what is it ? mysql version is 5.7.12 , strange things is they are all no frm file
-rw-r----- 1 mysql mysql 84M Aug 20 13:56 FTS_0000000000002fe2_000000000000694c_INDEX_1.ibd
-rw-r----- 1 mysql mysql 12M Aug 20 13:55 FTS_0000000000002fe2_000000000000694c_INDEX_2.ibd
-rw-r----- 1 mysql mysql 7.0M Aug 20 13:52 FTS_0000000000002fe2_000000000000694c_INDEX_3.ibd
-rw-r----- 1 mysql mysql 496K Aug 20 13:52 FTS_0000000000002fe2_000000000000694c_INDEX_4.ibd
-rw-r----- 1 mysql mysql 448K Aug 20 13:53 FTS_0000000000002fe2_000000000000694c_INDEX_5.ibd
-rw-r----- 1 mysql mysql 7.0M Aug 20 13:55 FTS_0000000000002fe2_000000000000694c_INDEX_6.ibd
-rw-r----- 1 mysql mysql 96K Aug 20 13:46 FTS_0000000000002fe2_BEING_DELETED_CACHE.ibd
-rw-r----- 1 mysql mysql 96K Aug 20 13:46 FTS_0000000000002fe2_BEING_DELETED.ibd
-rw-r----- 1 mysql mysql 96K Aug 20 13:56 FTS_0000000000002fe2_CONFIG.ibd
-rw-r----- 1 mysql mysql 96K Aug 20 13:46 FTS_0000000000002fe2_DELETED_CACHE.ibd
-rw-r----- 1 mysql mysql 96K Aug 20 13:46 FTS_0000000000002fe2_DELETED.ibd
-rw-r----- 1 mysql mysql 396M Aug 21 20:59 FTS_000000000000304c_00000000000069eb_INDEX_1.ibd
-rw-r----- 1 mysql mysql 40M Aug 21 20:58 FTS_000000000000304c_00000000000069eb_INDEX_2.ibd
-rw-r----- 1 mysql mysql 11M Aug 21 20:58 FTS_000000000000304c_00000000000069eb_INDEX_3.ibd
-rw-r----- 1 mysql mysql 10M Aug 21 20:58 FTS_000000000000304c_00000000000069eb_INDEX_4.ibd
-rw-r----- 1 mysql mysql 9.0M Aug 21 20:58 FTS_000000000000304c_00000000000069eb_INDEX_5.ibd
-rw-r----- 1 mysql mysql 10M Aug 21 20:58 FTS_000000000000304c_00000000000069eb_INDEX_6.ibd
-rw-r----- 1 mysql mysql 96K Aug 21 20:32 FTS_000000000000304c_00000000000069f2_INDEX_1.ibd
-rw-r----- 1 mysql mysql 848M Aug 21 20:59 FTS_000000000000304c_00000000000069f2_INDEX_2.ibd
-rw-r----- 1 mysql mysql 96K Aug 21 20:32 FTS_000000000000304c_00000000000069f2_INDEX_3.ibd
-rw-r----- 1 mysql mysql 96K Aug 21 20:32 FTS_000000000000304c_00000000000069f2_INDEX_4.ibd
-rw-r----- 1 mysql mysql 96K Aug 21 20:32 FTS_000000000000304c_00000000000069f2_INDEX_5.ibd
-rw-r----- 1 mysql mysql 96K Aug 21 20:32 FTS_000000000000304c_00000000000069f2_INDEX_6.ibd
and i check two of these file ,find some content , i can not know.
# strings FTS_0000000000003c97_BEING_DELETED_CACHE.ibd
infimum
supremum
# strings FTS_0000000000003c97_CONFIG.ibd
infimum
supremum
|cache_size_in_mb
1optimize_checkpoint_limit
Jsynced_doc_id
deleted_doc_count
!table_state
,use_stopword
The FTS_*.ibd files are the InnoDB FULLTEXT Search (FTS) index files. InnoDB introduced Full Text Searching from MySQL version 5.6 and onwards. They store only FTS indexing data. You possibly have some InnoDB table(s) with FTS defined on few field(s).
Indexing data is split up into 6 partitions. The ...INDEX_1.ibd to ...INDEX_6.ibd table files contain the FTS index data (6 parts).
FTS_DELETED and FTS__DELETED_CACHE
Contain the document IDs (DOC_ID) for documents that are deleted but
whose data is not yet removed from the full-text index. The
FTS_DELETED_CACHE is the in-memory version of the FTS_DELETED
table.
FTS__BEING_DELETED and FTS__BEING_DELETED_CACHE
Contain the document IDs (DOC_ID) for documents that are deleted and
whose data is currently in the process of being removed from the
full-text index. The FTS_BEING_DELETED_CACHE table is the in-memory
version of the FTS_BEING_DELETED table.
FTS_CONFIG
Stores information about the internal state of the FULLTEXT index.
From MySQL 5.6.6 and higher, InnoDB engine enabled innodb_file_per_table approach. From Docs:
Historically, InnoDB tables were stored in the system tablespace....
[Now] each InnoDB table is stored in its own tablespace data file (.ibd
file). This feature is controlled by the innodb_file_per_table
configuration option, which is enabled by default.
More from the docs:
With innodb_file_per_table enabled, you can store InnoDB tables in a
tbl_name.ibd file. Unlike the MyISAM storage engine, with its separate
tbl_name.MYD and tbl_name.MYI files for indexes and data, InnoDB
stores the data and the indexes together in a single .ibd file. The
tbl_name.frm file is still created as usual.
I just enabled mysql slow query logging.
Now I see these queries being logged on different tables time to time:
SELECT /*!40001 SQL_NO_CACHE */ * FROM `paitents`;
# Time: 181128 6:38:50
# User#Host: my_testdatabase[my_testdatabase] # localhost []
# Query_time: 2.964142 Lock_time: 0.000081 Rows_sent: 3 Rows_examined: 1606915
I just searched and found out that it might be the database dump causing these queries.
But I want to make sure that its the mysql dump not some unauthorized access.
This is the latest log from that specific table in my logs right now:
SELECT /*!40001 SQL_NO_CACHE */ * FROM `paitents`;
# Time: 181128 6:38:50
# User#Host: my_testdatabase[my_testdatabase] # localhost []
# Query_time: 2.964142 Lock_time: 0.000081 Rows_sent: 3 Rows_examined: 1606915
And here is the logs of dumps that were created:
-rw-r--r-- 1 root root 381511206 Nov 23 23:21 my_testdatabase_2018-11-23.sql.tar.bz2
-rw-r--r-- 1 root root 381754145 Nov 24 23:21 my_testdatabase_2018-11-24.sql.tar.bz2
-rw-r--r-- 1 root root 381999764 Nov 25 23:21 my_testdatabase_2018-11-25.sql.tar.bz2
-rw-r--r-- 1 root root 382146325 Nov 26 23:22 my_testdatabase_2018-11-26.sql.tar.bz2
-rw-r--r-- 1 root root 382357755 Nov 27 23:23 my_testdatabase_2018-11-27.sql.tar.bz2
-rw-r--r-- 1 root root 382384209 Nov 28 06:29 my_testdatabase_2018-11-28.sql.tar.bz2
Now here I can see the difference in the latest query logged in slow query log and the latest dump created.
Latest query logged time: 181128 6:38:50
Latest dump created time: 2018-11-28 06:29
Why is there a difference?
I am new to mariadb. Today, I was attempting to import a mysql database to mariadb and during the process the import stops when a warning is encountered as shown below.
Now, I said to myself that I should check a log file so I can see the error but I can't seem to fine any log file. I ran the query below with help from Get the error log of Mariadb:
As you can see there is no path to an error log file.
Next I checked /var/lib/mysql and below is the dir content:
-rw-rw----. 1 mysql mysql 16384 Jun 5 16:03 aria_log.00000001
-rw-rw----. 1 mysql mysql 52 Jun 5 16:03 aria_log_control
-rw-rw----. 1 mysql mysql 79691776 Jun 8 08:02 ibdata1
-rw-rw----. 1 mysql mysql 50331648 Jun 8 08:02 ib_logfile0
-rw-rw----. 1 mysql mysql 50331648 Jun 5 16:03 ib_logfile1
-rw-rw----. 1 mysql mysql 6 Jun 5 16:12 IMSPRO.pid
drwx------. 2 mysql mysql 4096 Jun 8 08:02 ecommence
-rw-rw----. 1 mysql mysql 0 Jun 5 16:12 multi-master.info
drwx--x--x. 2 mysql mysql 4096 Jun 5 16:03 mysql
srwxrwxrwx. 1 mysql mysql 0 Jun 5 16:12 mysql.sock
drwx------. 2 mysql mysql 20 Jun 5 16:03 performance_schema
-rw-rw----. 1 mysql mysql 24576 Jun 5 16:12 tc.log
No file in the above dir logs error.
Below is the content of my /etc/my.cnf
#
# This group is read both both by the client and the server
# use it for options that affect everything
#
[client-server]
#
# include all files from the config directory
#
!includedir /etc/my.cnf.d
Below is the content of /etc/my.cnf.d
drwxr-xr-x. 2 root root 117 Jun 5 16:02 .
drwxr-xr-x. 91 root root 8192 Jun 7 01:14 ..
-rw-r--r--. 1 root root 295 May 29 16:48 client.cnf
-rw-r--r--. 1 root root 763 May 29 16:48 enable_encryption.preset
-rw-r--r--. 1 root root 232 May 29 16:48 mysql-clients.cnf
-rw-r--r--. 1 root root 1080 May 29 16:48 server.cnf
-rw-r--r--. 1 root root 285 May 29 16:48 tokudb.cnf
What can I do to get error log?
The way to see the warnings is to type this immediately after receiving that "Warnings: 1":
SHOW WARNINGS;
(As soon as the next other command is run, the warnings are cleared.)
In mariadb version 10.3.29,
#show variables like 'log-error';
is showing "Empty set" output
Instead, the following command is working
show global variables like 'log_error';
In my case, I edited /etc/my.cnf and added the line log_error after [mysqld]:
[mysqld]
...
log_error
After that, the query show variables like 'log_error'; displays the following (before the change, the Value column was empty):
+---------------+--------------------------+
| Variable_name | Value |
+---------------+--------------------------+
| log_error | /var/lib/mysql/host.err |
+---------------+--------------------------+
Now the error log is being written to the above file.
The exact name of the file will vary from server to server and will take the name of the current host, so expect it to be different in your particular case.
I have a data base that includes one file .opt and a three files .frm .mid .myd for each entity in this DB.
can anyone help me with importing this data base to mySql?
Thanks
Do you mean .MYI instead of *.MID.
Filename with extensions .FRM .MYD .MYI in MySQL are MyISAM Tables. You can just simply copy these files into database folder.
mysql> create database myDatabase;
Query OK, 1 row affected (0.00 sec)
mysql> quit
Bye
[root#venus cart]# ls tt*.*
tt.frm tt.MYD tt.MYI
[root#venus cart]# cp tt.* /var/lib/mysql/myDatabase/
[root#venus cart]#
[root#venus cart]#
[root#venus cart]# cd /var/lib/mysql/myDatabase/
[root#venus myDatabase]# ll
total 24
-rw-rw----. 1 mysql mysql 65 Apr 15 10:36 db.opt
-rw-r-----. 1 root root 8582 Apr 15 10:37 tt.frm
-rw-r-----. 1 root root 18 Apr 15 10:37 tt.MYD
-rw-r-----. 1 root root 3072 Apr 15 10:37 tt.MYI
[root#venus myDatabase]# chown mysql.mysql tt.*
[root#venus myDatabase]# ll
total 24
-rw-rw----. 1 mysql mysql 65 Apr 15 10:36 db.opt
-rw-r-----. 1 mysql mysql 8582 Apr 15 10:37 tt.frm
-rw-r-----. 1 mysql mysql 18 Apr 15 10:37 tt.MYD
-rw-r-----. 1 mysql mysql 3072 Apr 15 10:37 tt.MYI
[root#venus myDatabase]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.5.36 MySQL Community Server (GPL)
Copyright (c) 2000, 2014, 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> use myDatabase;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> SELECT * FROM tt;
+----+------+
| id | c1 |
+----+------+
| 2 | 3 |
| 3 | 2 |
+----+------+
2 rows in set (0.00 sec)
I just installed mysql for the first time and created a databse with create database foo;
I think I have found where mysql stores the databases (/var/lib/mysql). When I try to cd to the foo directory I get permission denied. When I try with sudo nothing happens.
output of ls -l
-rw-rw----. 1 mysql mysql 16384 Feb 21 17:44 aria_log.00000001
-rw-rw----. 1 mysql mysql 52 Feb 21 17:44 aria_log_control
drwx------. 2 mysql mysql 4096 Mar 1 22:08 foo
-rw-rw----. 1 mysql mysql 18874368 Feb 21 17:44 ibdata1
-rw-rw----. 1 mysql mysql 5242880 Mar 1 16:05 ib_logfile0
-rw-rw----. 1 mysql mysql 5242880 Feb 21 17:34 ib_logfile1
drwx------. 2 mysql mysql 4096 Feb 21 17:34 mysql
srwxrwxrwx. 1 mysql mysql 0 Mar 1 16:05 mysql.sock
drwx------. 2 mysql mysql 4096 Feb 21 17:34 performance_schema
I know your meant to view the databases and stuff through that application on the command line but I am interested as to why I can't view the foo directory when i am root.
You can't view the foo directory because of the permissions:
owner - mysql - read, write, execute
group - mysql - no access
other - no access
First connect to mysql from command prompt using
[root#host]# mysql -u root -p
Enter password:******
Now select the database using
mysql> USE DB_Name
You can use belo command to have the list of databases
mysql> SHOW DATABASES;
To get the directory details you can use
mysql -uUSER -p -e 'SHOW VARIABLES WHERE Variable_Name = "dir_name"