PhpMyAdmin and Mysql databases [closed]

2019-10-03 04:19发布

问题:

I installed wordpress on localhost and made database - wordpress un phpmyadmin.

When I try to connect wordpress database through terminal, it shows that there is no such database - wordpress but mysql, information_schema,performance_schema,test.

Why it is like that and how can I fix it ?

回答1:

Try to add database in the phpmyadmin and change the wp-config-sample.php to wp-config.php and provide your username, password and database name...

like

/** The name of the database for WordPress */
define('DB_NAME', 'test');

/** MySQL database username */
define('DB_USER', 'root');

/** MySQL database password */
define('DB_PASSWORD', 'test');

/** MySQL hostname */
define('DB_HOST', 'localhost');

Reference word-press installation



回答2:

add database in the phpmyadmin ex. text

Install Wordpress steps


Step 1 )


Step 2 )


Step 3)

Open your wordpress folder and look this wp-config-sample.php rename wp-config-sample.php to wp-config.php


Step 4 )

and open rename file wp-config.php and Paste step 3 code and save this file

Step 5 )

After save wp-config.php don't refresh only click "Run the Install"


step 6)

Enjoy Install Your Wordpress



回答3:

So you see the database from within phpMyAdmin and want to know why you can't see it from the command line (terminal); this appears to be because you're not connected as the same user. Even if you're connected as the same user name, if one user is connected via sockets and the other through the TCP/IP connection it would explain the problem because MySQL treats different incoming hosts and connection types as different users.

To check this, look at the main page of phpMyAdmin, on the right side where it shows "Server" and "User" listed under the Database server section. Then connect from the command line client and run the status; command, and compare the output.

To fix it, either connect as the correct user (the -u and -h options may be helpful here), or grant the proper permissions to the user you're connecting as from the command line.