Missing wp_user Table, no access to my own website, how to fix?

69 Views Asked by At

Friday I ran a standard edit on my website and created a backup prior to starting. A plugin failed during namecheap maintenance and hundreds of my backups were lost and now 1 out of the handful left was regenerated from 2018 but without a wp_user table. Without that, I have no privileges or credentials to log in and edit my site. What do I do?? Currently waiting to hear from Namecheap if a more recent Nov 2023 backup they "found" has a wp_user table. SOS its been 3 awful days with little help and urgency from Namecheap.

I am looking into trying to creat fresh tables, then when go to /wp-admin it hopefully it will ask me to register a new user for the current backup.

1

There are 1 best solutions below

0
twofed On

Here's the SQL query you can execute in your hosting control panel to create the table you need:

CREATE TABLE `wp_users` (
  `ID` bigint(20) UNSIGNED NOT NULL,
  `user_login` varchar(60) COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT '',
  `user_pass` varchar(255) COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT '',
  `user_nicename` varchar(50) COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT '',
  `user_email` varchar(100) COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT '',
  `user_url` varchar(100) COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT '',
  `user_registered` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `user_activation_key` varchar(255) COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT '',
  `user_status` int(11) NOT NULL DEFAULT '0',
  `display_name` varchar(250) COLLATE utf8mb4_unicode_520_ci NOT NULL DEFAULT ''
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_520_ci;

INSERT INTO `wp_users` (`ID`, `user_login`, `user_pass`, `user_nicename`, `user_email`, `user_url`, `user_registered`, `user_activation_key`, `user_status`, `display_name`) VALUES
(1, 'your_login', 'xxx', 'your_nicename', 'your_email', '', '2020-02-16 02:47:49', '', 0, 'your_name');

ALTER TABLE `wp_users`
  ADD PRIMARY KEY (`ID`),
  ADD KEY `user_login_key` (`user_login`),
  ADD KEY `user_nicename` (`user_nicename`),
  ADD KEY `user_email` (`user_email`);

ALTER TABLE `wp_users`
  MODIFY `ID` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
COMMIT;

This will help you to create a base wp_users table structure with one admin row. You can replace your_login, your_nicename, your_email and your_name in this code. After creating this table, you can go into your control panel and reset your password