Error 1146 table doesn't exist

Keywords: MySQL Database

                     

Solution to the problem that prompt table does not exist because of copying database directly

After the computer reinstalls the system and copies the original mysql data into it, most of the tables can be accessed, but several tables prompt that the tables do not exist:

error: 1146: Table 'your_table' doesn't exist
  • 1

In this case, you need to copy ibdata1 from the original mysql installation directory data
INNODB is a popular database engine of MYSQL database, which supports transaction (row level) and becomes possible in enterprise level applications.
Ibdata is used to store the data of the file, and the table files in the folder of the library name are just structures. Because the new version of mysql tries innodb by default, the ibdata1 file exists by default, and some data tables without this file will make errors.

If the startup error is found after replacing the ibdata file

[root@localhost data]# service mysql startRedirecting to /bin/systemctl start  mysql.serviceJob for mysqld.service failed because the control process exited with error code. See "systemctl status mysqld.service" and "journalctl -xe" for details.
  • 1
  • 2
  • 3
[root@localhost data]# systemctl status mysqld.service● mysqld.service - LSB: start and stop MySQL   Loaded: loaded (/etc/rc.d/init.d/mysqld; bad; vendor preset: disabled)   Active: failed (Result: exit-code) since Tue 2019-01-08 18:12:43 CST; 8s ago     Docs: man:systemd-sysv-generator(8)  Process: 11815 ExecStop=/etc/rc.d/init.d/mysqld stop (code=exited, status=0/SUCCESS)  Process: 13300 ExecStart=/etc/rc.d/init.d/mysqld start (code=exited, status=1/FAILURE)Jan 08 18:12:40 localhost.localdomain systemd[1]: Starting LSB: start and stop MySQL...Jan 08 18:12:43 localhost.localdomain mysqld[13300]: Starting MySQL... ERROR! The server quit without updating PID file (/www/server/data/localhost.localdomain.pid).Jan 08 18:12:43 localhost.localdomain systemd[1]: mysqld.service: control process exited, code=exited status=1Jan 08 18:12:43 localhost.localdomain systemd[1]: Failed to start LSB: start and stop MySQL.Jan 08 18:12:43 localhost.localdomain systemd[1]: Unit mysqld.service entered failed state.Jan 08 18:12:43 localhost.localdomain systemd[1]: mysqld.service failed.
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14

At this time, first check whether the users and user groups that your ibdata file belongs to are correct, which may be caused by permission problems.

If the data table is corrupt, please try to repair the table

repair table tablename

           

Posted by intercampus on Sun, 17 Nov 2019 11:25:56 -0800