Bug #90511 ERROR 1049 (42000): Unknown database 'test'
Submitted: 19 Apr 2018 14:12 Modified: 27 Apr 2018 5:57
Reporter: Wu TEd Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version:8.0.11 OS:CentOS (CentOS6.6)
Assigned to: CPU Architecture:Any

[19 Apr 2018 14:12] Wu TEd
Description:
I am trying to install mySQL server on CentOS6.6 without root access. 

But there is an Error message while accessing MySQL database:

mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1049 (42000): Unknown database 'test'

The "mysql.err" is as below:

[Warning] Changed limits: max_open_files: 1024 (requested 5000)
[Warning] Changed limits: table_open_cache: 431 (requested 2000)
[Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
[Warning] One can only use the --user switch if running as root

[Warning] InnoDB: New log files created, LSN=45790
[Warning] InnoDB: Creating foreign key constraint system tables.
[Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: ec2d7935-43d0-11e8-96ee-d89d6726c984.
[Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
[Note] A temporary password is generated for root@localhost: IL-Rp=Wj*3dg
[Warning] Changed limits: max_open_files: 1024 (requested 5000)
[Warning] Changed limits: table_open_cache: 431 (requested 2000)
[Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
[Warning] Insecure configuration for --secure-file-priv: Current value does not restrict location of generated files. Consider setting it to a valid, non-empty path.
[Note] ./mysqld (mysqld 5.7.13) starting as process 6390 ...
[Warning] One can only use the --user switch if running as root

[Note] InnoDB: PUNCH HOLE support not available
[Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
[Note] InnoDB: Uses event mutexes
[Note] InnoDB: GCC builtin __sync_synchronize() is used for memory barrier
[Note] InnoDB: Compressed tables use zlib 1.2.3
[Note] InnoDB: Using Linux native AIO
[Note] InnoDB: Number of pools: 1
[Note] InnoDB: Using CPU crc32 instructions
[Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
[Note] InnoDB: Completed initialization of buffer pool
[Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
[Note] InnoDB: Highest supported file format is Barracuda.
[Note] InnoDB: Creating shared tablespace for temporary tables
[Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
[Note] InnoDB: File './ibtmp1' size is now 12 MB.
[Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
[Note] InnoDB: 32 non-redo rollback segment(s) are active.
[Note] InnoDB: Waiting for purge to start
[Note] InnoDB: 5.7.13 started; log sequence number 2524437
[Note] InnoDB: Loading buffer pool(s) from [Base MySQL Directory]/mysql-5.7.13-linux-glibc2.5-x86_64/data/ib_buffer_pool
[Note] Plugin 'FEDERATED' is disabled.
[Warning] Failed to set up SSL because of the following SSL library error: SSL context is not usable without certificate and private key
[Note] Server hostname (bind-address): '*'; port: 3306
[Note] IPv6 is available.
[Note]   - '::' resolves to '::';
[Note] Server socket created on IP: '::'.
[Note] InnoDB: Buffer pool(s) load completed at 180419 20:55:57
[Note] Event Scheduler: Loaded 0 events
[Note] ./mysqld: ready for connections.
Version: '5.7.13'  socket: '[Base MySQL Directory]/thesock'  port: 3306  MySQL Community Server (GPL)

How to repeat:
1. Unpack mysql-5.7.13-linux-glibc2.5-x86_64 in a directory(EX:[Base MySQL Directory])

2. Initialize and generate root password:  ./mysqld --initialize --user=mysql --lc_messages_dir=[Base MySQL Directory]/share --basedir=[Base MySQL Directory] --datadir=[BaseMySQL Directory]/data --log-error=[Base MySQL Directory]/data/mysql.err --pid-file=[Base MySQL Directory]/mysql.pid --socket=[Base MySQL Directory]/thesock --port=3306 &

3. Start the server:  ./mysqld --user=mysql --basedir=[Base MySQL Directory] --lc_messages_dir=[Base MySQL Directory]/share --datadir=[Base MySQL Directory]/data --log-error=[Base MySQL Directory]/data/mysql.err --pid-file=[Base MySQL Directory]/mysql.pid --socket=[Base MySQL Directory]/thesock --port=3306 &

4. Access MySQL database:  ./mysql --socket=$MYSQL_TED_HOME/thesock --user=root --password="IL-Rp=Wj*3dg"
[20 Apr 2018 9:54] MySQL Verification Team
Thank you for taking the time to report a problem.  Unfortunately you are not using a current version of the product you reported a problem with -- the problem might already be fixed. Please download a new version from http://www.mysql.com/downloads/

If you are able to reproduce the bug with one of the latest versions, please change the version on this bug report to the version you tested and change the status back to "Open".  Again, thank you for your continued support of MySQL.
[22 Apr 2018 5:49] Wu TEd
Even I tried the latest version - 8.0.11, the issue is 100% same as 5.7.13.
[22 Apr 2018 7:25] MySQL Verification Team
obviously there's a rogue my.cnf lying around.
Try run like this:

mysql --no-defaults -uroot -p 

Does that work?
[27 Apr 2018 3:17] Wu TEd
Yes, it works!!!!
It's because there has already one MySQL server been installed in this machine, its my.cnf confuses the new MySQL server....

Thanks, now it goes very well.
[15 May 2020 7:16] Ashutosh Kumbhar
raise errors.get_mysql_exception(msg=exc.msg, errno=exc.errno,
mysql.connector.errors.ProgrammingError: 1049 (42000): Unknown database 'pysetup'
I am getting this error,even though I have the latest version of mysql.Can any one please help???