View previous topic :: View next topic |
Author |
Message |
happysmash27 Apprentice
Joined: 28 Mar 2016 Posts: 220
|
Posted: Thu Feb 22, 2018 2:42 am Post subject: A MySQL database already exists, but I have no clue why… |
|
|
I was trying to use MySQL as root, but for some reason, I always seem to get access denied as root but can access it as my normal user. When trying to set MySQL up to possibly avoid this and start from scratch, I get the following error:
Code: |
computer-pig happysmash27 # emerge --config dev-db/mysql
Configuring pkg...
* Trying to get password for mysql 'root' user from 'mysql' section ...
* Trying to get password for mysql 'root' user from 'client' section ...
* You have already a MySQL database in place.
* (///var/lib/mysql/*)
* Please rename or delete it if you wish to replace it.
* ERROR: dev-db/mysql-5.6.36::gentoo failed (config phase):
* MySQL database already exists!
*
* Call stack:
* ebuild.sh, line 124: Called pkg_config
* environment, line 4428: Called mysql-multilib-r1_pkg_config
* environment, line 4028: Called die
* The specific snippet of code:
* die "MySQL database already exists!";
*
* If you need support, post the output of `emerge --info '=dev-db/mysql-5.6.36::gentoo'`,
* the complete build log and the output of `emerge -pqv '=dev-db/mysql-5.6.36::gentoo'`.
* The complete build log is located at '/var/tmp/portage/dev-db/mysql-5.6.36/temp/build.log'.
* The ebuild environment file is located at '/var/tmp/portage/dev-db/mysql-5.6.36/temp/environment'.
* Working directory: '/var/tmp/portage/dev-db/mysql-5.6.36/homedir'
* S: '/var/tmp/portage/dev-db/mysql-5.6.36/work/mysql-5.6.36'
|
When running MySQL as my normal user, I see an empty table called "test" and a full table called information_schema:
Code: |
happysmash27@computer-pig ~ % mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.6.36-log Source distribution
Copyright (c) 2000, 2017, 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> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| test |
+--------------------+
2 rows in set (0,00 sec)
mysql> use information_schema;
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> show tables
-> ;
+---------------------------------------+
| Tables_in_information_schema |
+---------------------------------------+
| CHARACTER_SETS |
| COLLATIONS |
| COLLATION_CHARACTER_SET_APPLICABILITY |
| COLUMNS |
| COLUMN_PRIVILEGES |
| ENGINES |
| EVENTS |
| FILES |
| GLOBAL_STATUS |
| GLOBAL_VARIABLES |
| KEY_COLUMN_USAGE |
| OPTIMIZER_TRACE |
| PARAMETERS |
| PARTITIONS |
| PLUGINS |
| PROCESSLIST |
| PROFILING |
| REFERENTIAL_CONSTRAINTS |
| ROUTINES |
| SCHEMATA |
| SCHEMA_PRIVILEGES |
| SESSION_STATUS |
| SESSION_VARIABLES |
| STATISTICS |
| TABLES |
| TABLESPACES |
| TABLE_CONSTRAINTS |
| TABLE_PRIVILEGES |
| TRIGGERS |
| USER_PRIVILEGES |
| VIEWS |
| INNODB_LOCKS |
| INNODB_TRX |
| INNODB_SYS_DATAFILES |
| INNODB_LOCK_WAITS |
| INNODB_SYS_TABLESTATS |
| INNODB_CMP |
| INNODB_METRICS |
| INNODB_CMP_RESET |
| INNODB_CMP_PER_INDEX |
| INNODB_CMPMEM_RESET |
| INNODB_FT_DELETED |
| INNODB_BUFFER_PAGE_LRU |
| INNODB_SYS_FOREIGN |
| INNODB_SYS_COLUMNS |
| INNODB_SYS_INDEXES |
| INNODB_FT_DEFAULT_STOPWORD |
| INNODB_SYS_FIELDS |
| INNODB_CMP_PER_INDEX_RESET |
| INNODB_BUFFER_PAGE |
| INNODB_CMPMEM |
| INNODB_FT_INDEX_TABLE |
| INNODB_FT_BEING_DELETED |
| INNODB_SYS_TABLESPACES |
| INNODB_FT_INDEX_CACHE |
| INNODB_SYS_FOREIGN_COLS |
| INNODB_SYS_TABLES |
| INNODB_BUFFER_POOL_STATS |
| INNODB_FT_CONFIG |
+---------------------------------------+
59 rows in set (0,00 sec)
mysql> describe files;
+----------------------+---------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------------------+---------------------+------+-----+---------+-------+
| FILE_ID | bigint(4) | NO | | 0 | |
| FILE_NAME | varchar(64) | YES | | NULL | |
| FILE_TYPE | varchar(20) | NO | | | |
| TABLESPACE_NAME | varchar(64) | YES | | NULL | |
| TABLE_CATALOG | varchar(64) | NO | | | |
| TABLE_SCHEMA | varchar(64) | YES | | NULL | |
| TABLE_NAME | varchar(64) | YES | | NULL | |
| LOGFILE_GROUP_NAME | varchar(64) | YES | | NULL | |
| LOGFILE_GROUP_NUMBER | bigint(4) | YES | | NULL | |
| ENGINE | varchar(64) | NO | | | |
| FULLTEXT_KEYS | varchar(64) | YES | | NULL | |
| DELETED_ROWS | bigint(4) | YES | | NULL | |
| UPDATE_COUNT | bigint(4) | YES | | NULL | |
| FREE_EXTENTS | bigint(4) | YES | | NULL | |
| TOTAL_EXTENTS | bigint(4) | YES | | NULL | |
| EXTENT_SIZE | bigint(4) | NO | | 0 | |
| INITIAL_SIZE | bigint(21) unsigned | YES | | NULL | |
| MAXIMUM_SIZE | bigint(21) unsigned | YES | | NULL | |
| AUTOEXTEND_SIZE | bigint(21) unsigned | YES | | NULL | |
| CREATION_TIME | datetime | YES | | NULL | |
| LAST_UPDATE_TIME | datetime | YES | | NULL | |
| LAST_ACCESS_TIME | datetime | YES | | NULL | |
| RECOVER_TIME | bigint(4) | YES | | NULL | |
| TRANSACTION_COUNTER | bigint(4) | YES | | NULL | |
| VERSION | bigint(21) unsigned | YES | | NULL | |
| ROW_FORMAT | varchar(10) | YES | | NULL | |
| TABLE_ROWS | bigint(21) unsigned | YES | | NULL | |
| AVG_ROW_LENGTH | bigint(21) unsigned | YES | | NULL | |
| DATA_LENGTH | bigint(21) unsigned | YES | | NULL | |
| MAX_DATA_LENGTH | bigint(21) unsigned | YES | | NULL | |
| INDEX_LENGTH | bigint(21) unsigned | YES | | NULL | |
| DATA_FREE | bigint(21) unsigned | YES | | NULL | |
| CREATE_TIME | datetime | YES | | NULL | |
| UPDATE_TIME | datetime | YES | | NULL | |
| CHECK_TIME | datetime | YES | | NULL | |
| CHECKSUM | bigint(21) unsigned | YES | | NULL | |
| STATUS | varchar(20) | NO | | | |
| EXTRA | varchar(255) | YES | | NULL | |
+----------------------+---------------------+------+-----+---------+-------+
38 rows in set (0,00 sec)
mysql> use test;
Database changed
mysql> show tables;
Empty set (0,00 sec)
mysql> use information_schema
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> show processlist;
ERROR 1227 (42000): Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
mysql> Ctrl-C -- exit!
Aborted
|
I cannot figure out why a database already exists, nor what could possibly be using it due to the access denied error above. Does anyone know what this database is, and/or how I can figure out if anything important is using it; Is it safe to nuke my MySQL directory? |
|
Back to top |
|
|
pjp Administrator
Joined: 16 Apr 2002 Posts: 20067
|
|
Back to top |
|
|
szatox Advocate
Joined: 27 Aug 2013 Posts: 3134
|
Posted: Thu Feb 22, 2018 8:04 pm Post subject: |
|
|
You probably have a file .my.cnf in your $HOME, with limited credentials there.
You don't see the "mysql" database, so you're not running god mode there.
Regarding acce3ss as root, this part is usually done via a chmod protected socked socket AKA "if your OS allows you to connect, you are permitted to do that"
This said, access via that socket can be restricted by the database itself too. It is also possible that you have settings pointing your root user to a tcp port instead of unix socket, but there are no credentials stored in that config file.
So, you can read configs in /etc/mysql, or simply shut the db server down and invoke it as mysql_safe instead - with all authentication features disabled. You can then login as root and have a look at permissions stored in table mysql.user |
|
Back to top |
|
|
happysmash27 Apprentice
Joined: 28 Mar 2016 Posts: 220
|
Posted: Mon Feb 26, 2018 12:19 am Post subject: |
|
|
szatox wrote: | You probably have a file .my.cnf in your $HOME, with limited credentials there.
You don't see the "mysql" database, so you're not running god mode there.
Regarding acce3ss as root, this part is usually done via a chmod protected socked socket AKA "if your OS allows you to connect, you are permitted to do that"
This said, access via that socket can be restricted by the database itself too. It is also possible that you have settings pointing your root user to a tcp port instead of unix socket, but there are no credentials stored in that config file.
So, you can read configs in /etc/mysql, or simply shut the db server down and invoke it as mysql_safe instead - with all authentication features disabled. You can then login as root and have a look at permissions stored in table mysql.user |
I ran and now I'm in an even worse situation: it is refusing to shut down! Also, .my.cnf does not exist in my $HOME. |
|
Back to top |
|
|
happysmash27 Apprentice
Joined: 28 Mar 2016 Posts: 220
|
Posted: Mon Feb 26, 2018 12:36 am Post subject: |
|
|
happysmash27 wrote: | szatox wrote: | You probably have a file .my.cnf in your $HOME, with limited credentials there.
You don't see the "mysql" database, so you're not running god mode there.
Regarding acce3ss as root, this part is usually done via a chmod protected socked socket AKA "if your OS allows you to connect, you are permitted to do that"
This said, access via that socket can be restricted by the database itself too. It is also possible that you have settings pointing your root user to a tcp port instead of unix socket, but there are no credentials stored in that config file.
So, you can read configs in /etc/mysql, or simply shut the db server down and invoke it as mysql_safe instead - with all authentication features disabled. You can then login as root and have a look at permissions stored in table mysql.user |
I ran and now I'm in an even worse situation: it is refusing to shut down! Also, .my.cnf does not exist in my $HOME. |
Okay, killing mysqld instead of mysqld_safe seems to have worked, but that situation wasn't very good at all... |
|
Back to top |
|
|
szatox Advocate
Joined: 27 Aug 2013 Posts: 3134
|
Posted: Mon Feb 26, 2018 9:13 pm Post subject: |
|
|
Did you get to inspecting permissions and - possibly - setting a new password for your user? |
|
Back to top |
|
|
happysmash27 Apprentice
Joined: 28 Mar 2016 Posts: 220
|
Posted: Tue Feb 27, 2018 12:19 am Post subject: |
|
|
szatox wrote: | Did you get to inspecting permissions and - possibly - setting a new password for your user? |
I ended up just making a backup and reinstalling. The databases from before seem to exist, and nothing has broken so far... |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|