Spread the word.

Share the link on social media.

Share
  • Facebook
Have an account? Sign In Now

Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In


Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.


Have an account? Sign In Now

You must login to ask question.

Forgot Password?

Don't have account, Sign Up Here
Please subscribe to paid membership

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

Fiwazo Community

Fiwazo Community Logo Fiwazo Community Logo

Fiwazo Community Navigation

  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • Marketplace
Home/ Questions/Q 224
Answered
Fiwazo
  • 1
FiwazoPundit
Asked: January 19, 20222022-01-19T11:37:56+05:30 2022-01-19T11:37:56+05:30In: Wordpress

Error establishing a database connection

  • 1
Error establishing a database connection

Hi

I try to run WordPress on my MacBook and keep getting an error establishing a database connection. I try to write database name, username, password, and leave database host as localhost and leave table prefix as wp_ and seems can’t make a connection to the database. When I install mamp didn’t give me any error.

database issuewordpress
  • 2 2 Answers
  • 13 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report
Leave an answer

Leave an answer
Cancel reply

Browse

2 Answers

  • Voted
  • Oldest
  • Recent
  • Random
  1. Maxkinon New Member
    2022-01-19T11:39:55+05:30Added an answer on January 19, 2022 at 11:39 am

    This can happen when you’ve modified or entered your database details incorrectly, such as:

    • Your database host.
    • Database username.
    • Database password.

    Alternatively, your database could be unresponsive or corrupted.

    To fix this common WordPress issue, you should first see if you get the same error on your website’s front and back end (wp-admin).

    If you get a different error on the wp-admin page of your website, such as “One or more database tables are unavailable. The database may need to be repaired”, you need to repair your database.

    Repairing your database is pretty simple. FTP into your website and add the following line of code into your wp-config.php file just before the ‘That’s all, stop editing!’ line:

    define('WP_ALLOW_REPAIR', true);

    Now save the changes, re-upload the file to your server, and visit this page:

    http://www.yoursite.com/wp-admin/maint/repair.php
    
    When you’ve finished repairing your database, remove the line from your wp-config.php file.
    • 1
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report
  2. Best Answer
    Maxkinon New Member
    2022-01-19T11:42:14+05:30Added an answer on January 19, 2022 at 11:42 am

    Ignore the mydbname, myusername and mypassword. I didn’t want to write my credentials. Just change your database and password or database user name.

    <?php
    /**
     * The base configuration for WordPress
     *
     * The wp-config.php creation script uses this file during the
     * installation. You don't have to use the web site, you can
     * copy this file to "wp-config.php" and fill in the values.
     *
     * This file contains the following configurations:
     *
     * * MySQL settings
     * * Secret keys
     * * Database table prefix
     * * ABSPATH
     *
     * @link https://codex.wordpress.org/Editing_wp-config.php
     *
     * @package WordPress
     */
    
    // ** MySQL settings - You can get this info from your web host ** //
    /** The name of the database for WordPress */
    define( 'DB_NAME', 'mydbname' );
    
    /** MySQL database username */
    define( 'DB_USER', 'myusername' );
    
    /** MySQL database password */
    define( 'DB_PASSWORD', 'mypassword' );
    
    /** MySQL hostname */
    define( 'DB_HOST', 'localhost' );
    
    /** Database Charset to use in creating database tables. */
    define( 'DB_CHARSET', 'utf8' );
    
    /** The Database Collate type. Don't change this if in doubt. */
    define( 'DB_COLLATE', '' );
    
    /**#@+
     * Authentication Unique Keys and Salts.
     *
     * Change these to different unique phrases!
     * You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}
     * You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again.
     *
     * @since 2.6.0
     */
    define( 'AUTH_KEY',         'put your unique phrase here' );
    define( 'SECURE_AUTH_KEY',  'put your unique phrase here' );
    define( 'LOGGED_IN_KEY',    'put your unique phrase here' );
    define( 'NONCE_KEY',        'put your unique phrase here' );
    define( 'AUTH_SALT',        'put your unique phrase here' );
    define( 'SECURE_AUTH_SALT', 'put your unique phrase here' );
    define( 'LOGGED_IN_SALT',   'put your unique phrase here' );
    define( 'NONCE_SALT',       'put your unique phrase here' );
    
    /**#@-*/
    
    /**
     * WordPress Database Table prefix.
     *
     * You can have multiple installations in one database if you give each
     * a unique prefix. Only numbers, letters, and underscores please!
     */
    $table_prefix = 'wp_';
    
    /**
     * For developers: WordPress debugging mode.
     *
     * Change this to true to enable the display of notices during development.
     * It is strongly recommended that plugin and theme developers use WP_DEBUG
     * in their development environments.
     *
     * For information on other constants that can be used for debugging,
     * visit the Codex.
     *
     * @link https://codex.wordpress.org/Debugging_in_WordPress
     */
    define( 'WP_DEBUG', false );
    
    /* That's all, stop editing! Happy publishing. */
    
    /** Absolute path to the WordPress directory. */
    if ( ! defined( 'ABSPATH' ) ) {
    	define( 'ABSPATH', dirname( __FILE__ ) . '/' );
    }
    
    /** Sets up WordPress vars and included files. */
    require_once( ABSPATH . 'wp-settings.php' );
    • 1
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 10
  • Answers 9
  • Best Answers 2
  • Users 3
  • Popular
  • Answers
  • Fiwazo

    Which graduate program should I choose – SUNY Buffalo or ...

    • 3 Answers
  • Farid

    Mismatched “post_max_size” and “upload_max_filesize” values.

    • 2 Answers
  • Farid

    LearnDash Certificate Unique ID Generator Plugin not working

    • 2 Answers
  • Maxkinon
    Maxkinon added an answer Ignore the mydbname, myusername and mypassword. I didn’t want to… January 19, 2022 at 11:42 am
  • Maxkinon
    Maxkinon added an answer This can happen when you’ve modified or entered your database… January 19, 2022 at 11:39 am
  • Farid
    Farid added an answer Thank you maxkinon, It's working. January 19, 2022 at 11:16 am

Related Questions

  • Farid

    LearnDash Certificate Unique ID Generator Plugin not working

    • 2 Answers
  • Farid

    Mismatched “post_max_size” and “upload_max_filesize” values.

    • 2 Answers

Top Members

Fiwazo

Fiwazo

  • 8 Questions
  • 312 Points
Pundit
Maxkinon

Maxkinon

  • 0 Questions
  • 42 Points
New Member
Farid

Farid

  • 2 Questions
  • 25 Points
New Member

Trending Tags

6ammart cloud storage database issue delivery app fluxstore free storage learndash plugin mpwa mstore plugin plugin issue post wa gateway what's app gateway wordpress

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • Marketplace

Footer

Fiwazo Community

Fiwazo Community

Fiwazo is a social questions & Answers Engine which will help you establis your community and connect with other people.

About Us

  • Meet The Team
  • Blog
  • About Us
  • Contact Us

Legal Stuff

  • Terms of Use
  • Privacy Policy
  • Cookie Policy

Help Desk

  • Knowledge Base
  • Help Desk

Follow

© 2021 Fiwazo. All Rights Reserved
With Love by Maxkinon Team

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.