Mac安装好xampp之后,启动各项环境软件,登录phpmyadmin正常,创建数据库正常但安装登录Wordpress显示“Error establishing a database connection”
工具/原料
方法/步骤
1点开xampp里面的Volumes,找到下面的Explore,点击进入。
4这时候你可以看到很多带'.php'后缀的文件,随意复制一个。我复制的是wp-config-sample.php,之后用windows的记事本或者mac的文本编辑器打开,将里面的内容全部删掉。
5将下面的这段代码全部复制进上一步打开的那个“.php“文件里。 {=rX;DX}rh>N^*5}/=oWcRB&Grvd*$h{%X+~3TbE[Ny9Y/!t>J~' );define( 'LOGGED_IN_KEY', '6@^e(a!gc0sJg4j.th~JQ:qhrIZF[fL O@ovERp(9)NK-MNAXxr9e>w &B?e.N($' );define( 'NONCE_KEY', 'reTi*p(`.s>7.dHk9s|' );define( 'NONCE_SALT', ' oHHlSp7Orxxq^o? ^#?o/1ljZi^aoI@|J%?= h0S%[;aW6>cjJ%H}}/:NSmCO>>' ); /**#@-*/ /** * 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' );
6找到这个文件顶部的“已编辑”,点开重命名为“wp-config.php“,回车保存。
7做完这些之后,亲测Error establishing a database connection已消失。