Can’t select database (WAMP)
-
I am having trouble connecting my database to WordPress using WAMP at wp-admin setup.
I am following the steps in this tutorial:I’m entering the following information:
Database Name test_db
Username root
Password
Database Host localhost
Table Prefix wp_I click submit,
And I get “Can’t select database”- This topic was modified 4 years, 11 months ago by Steven Stern (sterndata).
-
That can happen when the DB user privileges were not set for the new DB. You should double check them. Enter the phpMyAdmin app by clicking the MySQL Admin button for WAMPP control panel. Under server 127.0.0.1 go to the user accounts tab and select Edit Privileges for the root@localhost user. Click the database button. Pick the test_db item and click Go. Checkmark the Check All box, then click Go.
I did as you suggested and edited the privileges (non of the boxes were checked).
I checked Check All and clicked go. It updated all the privileges, EXCEPT under Database-specific privileges, Administration, the GRANT box won’t stay checked. I’ve tried to check the box by itself and when I click go it doesn’t stay checked.
phpMyAdmin is giving me a caution message:
Note: You are attempting to edit privileges of the user with which you are currently logged in.I’m still getting the same error message at wp install:
Can’t select database
We were able to connect to the database server (which means your username and password is okay) but not able to select the test_db database.Are you sure it exists?
Does the user root have permission to use the test_db database?
On some systems the name of your database is prefixed with your username, so it would be like username_test_db. Could that be the problem?
If you don’t know how to set up a database you should contact your host. If all else fails you may find help at the WordPress Support Forums.Try renaming or creating anew a DB without using any special characters or uppercase in the name. “testdb” or whatever. If you couldn’t tell already, I’m just making guesses at this point as there’s little that could go wrong if the connection is working and privileges are set. WP doesn’t need admin privileges, so leaving those unchecked is OK.
Try adding the port to the database host configuration. For my install of WAMP, MySQL uses port 3308. When I changed the database host setting to read “localhost:3308” on the setup page, it worked and brought me to the ‘five minute install’ page (having erred on the previous 87 configuration attempts).
Blackfire sounds like the voice of hard won experience. While appending the port is a great suggestion in general and 3308 is a likely alternative port, don’t guess at ports to try. Look at your WAMP control panel and append the port it’s actually using for MySQL.
TBH, I don’t think it’ll help since WP in apparently connecting to the server correctly, there is no harm in trying anyway.
bcworkz:
I created a new database with the name “testdb”, and still got “Can’t select database”.
I edited the privileges as previously suggested on the newly created testdb, and still got “Can’t select database”.Blackfire2357:
I went into WAMP, MySql 8.0.18, and edited the “my.ini” file. It opened in Notepad++ and I did a find and replace for all the “3308” into “localhost:3308”. I saved it and restarted WAMP, but WAMP wouldn’t start up all the way, it got stuck on orange. Luckily, I backed up the original my.ini file to my desktop.Here’s what the modified my.ini looks like:
; MySQL config file. ; ; MySQL programs look for option files in a set of ; locations which depend on the deployment platform. ; You can copy this option file to one of those ; locations. For information about these locations, see: ; https://dev.mysql.com/doc/mysql/en/option-files.html ; ; In this file, you can use all long options that a program supports. ; If you want to know which options a program supports, run the program ; with the "--help" option. ; The following options will be passed to all MySQL clients [client] port =localhost:3308 socket = /tmp/mysql.sock ; Here follows entries for some specific programs ; The MySQL server used as a service ; https://dev.mysql.com/doc/refman/8.0/en/windows-start-service.html ; If the service-installation command specifies a service name other ; than MySQL following the --install option, the server uses that ; service name. It reads options from the [mysqld] group and the group ; that has the same name as the service in the standard option files. ; This enables you to use the [mysqld] group for options that should ; be used by all MySQL services, and an option group with the service ; name for use by the server installed with that service name. ; This [...] section has the name of the service [wampmysqld64] ;skip-grant-tables default_authentication_plugin=mysql_native_password port =localhost:3308 socket = /tmp/mysql.sock key_buffer_size = 256M max_allowed_packet = 64M ; Added to reduce memory used (minimum is 400) ; See Documentation: ; https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_table_definition_cache table_definition_cache = 600 sort_buffer_size = 2M net_buffer_length = 8K read_buffer_size = 2M read_rnd_buffer_size = 2M myisam_sort_buffer_size = 64M ;Path to mysql install directory basedir="c:/wamp64/bin/mysql/mysql8.0.18" log-error="c:/wamp64/logs/mysql.log" ;Verbosity Value 1 Errors only, 2 Errors and warnings , 3 Errors, warnings, and notes log_error_verbosity=2 ;Path to data directory datadir="c:/wamp64/bin/mysql/mysql8.0.18/data" ;Path to the language ;See Documentation: ; https://dev.mysql.com/doc/refman/8.0/en/error-message-language.html lc-messages-dir="c:/wamp64/bin/mysql/mysql8.0.18/share" lc-messages=en_US ; Default storage engine that will be used if the engine is not specified when creating tables. ; This does not prevent the creation of InnoDB tables, just specify ENGINE = InnoDB default-storage-engine=MYISAM ;Disabling X Plugin mysqlx=0 ;To avoid warning messages skip-ssl secure_file_priv="c:/wamp64/tmp" explicit_defaults_for_timestamp=true ; Set the SQL mode. See Documentation: ; https://dev.mysql.com/doc/refman/8.0/en/sql-mode.html sql-mode="" ;sql-mode="STRICT_ALL_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_ZERO_DATE,NO_ZERO_IN_DATE" ; Disable Federated by default skip-federated ; Replication Master Server (default) ; binary logging is required for replication skip-log-bin ;log-bin="c:/wamp64/logs/mysql-bin" ; binary logging format - mixed recommended ;binlog_format=mixed ; required unique id between 1 and 2^32 - 1 ; defaults to 1 if master-host is not set ; but will not function as a master if omitted server-id = 1 ; Replication Slave (comment out master section to use this) ; New for MySQL 5.6 if no slave skip-slave-start ; The InnoDB tablespace encryption feature relies on the keyring_file ; plugin for encryption key management, and the keyring_file plugin ; must be loaded prior to storage engine initialization to facilitate ; InnoDB recovery for encrypted tables. If you do not want to load the ; keyring_file plugin at server startup, specify an empty string. early-plugin-load="" innodb_data_file_path = ibdata1:12M:autoextend ; You can set .._buffer_pool_size up to 50 - 80 % ; of RAM but beware of setting memory usage too high innodb_buffer_pool_size = 256M ; Set .._log_file_size to 25 % of buffer pool size innodb_log_file_size = 64M innodb_log_buffer_size = 8M innodb_thread_concurrency = 16 innodb_flush_log_at_trx_commit = 1 innodb_lock_wait_timeout = 50 innodb_flush_method=normal [mysqldump] quick max_allowed_packet = 64M [mysql] no-auto-rehash ; Remove the next comment character if you are not familiar with SQL ;safe-updates [isamchk] key_buffer_size = 20M sort_buffer_size = 20M read_buffer_size = 2M write_buffer_size = 2M [myisamchk] key_buffer_size = 20M sort_buffer_size_size = 20M read_buffer_size = 2M write_buffer_size = 2M [mysqlhotcopy] interactive-timeout [mysqld] default_authentication_plugin=mysql_native_password port =localhost:3308
SOLVED!
During setup, wp-admin_setup-config.php_step=1, in the form for database connection details, I entered “localhost:3308” instead of “localhost” for Database Host.@anthonymezzapelle you are my hero. Spent some hours trying to figure out how to solve this issue. Tryed everything that was provided by Google and then i found this!
“localhost:3308” solved this for me too!
I almost gave up, Blackfire you are my hero.
Only took me an hour to find this….not too bad
My hero
“localhost:3308” worked like a charm!
“localhost:308” was exactly what was needed, 2 hours working through all the steps and double checking, wished I had read this first. Thank-you for the excellent recommendation.
@anthonymezzapelle you are the man bro jeje “localhost:3308” is the answer, thanks!!
For MariaDB, use localhost:3306
- The topic ‘Can’t select database (WAMP)’ is closed to new replies.