Sqlstate hy000 general error 1 no such table

SQLSTATE HY000 General error 1 no such table occurs due to a number of the tables used by Horde that are missing from the user's Horde SQLite database.

Are you getting SQLSTATE HY000 General error 1 no such table error?

Usually, this error occurs when trying to change the mail account webmail from Roundcube to Horde.

And the major reason will be missing tables in the database.

At Bobcares, we often get requests to fix email errors as a part of our Server Management Services.

Today, let’s have a look into the error and see how our Support Engineers fix it.

What is SQLSTATE[HY000]: General error: 1 no such table error?

Normally, this error is due to a number of the tables used by Horde that are missing from the user’s Horde SQLite database.

In general, control panel based servers there will more multiple webmail clients available. And, users have the privilege to choose one among them.

Recently one of our cPanel customers contacted us with this error. He tried to change the default webmail preference of a mail account under the user from Roundcube to Horde.

Default webmail preference

He got the below error:

How we fixed SQLSTATE HY000 General error 1 no such table error?

Now let’s see how our Support Engineers fixed this error effectively for our customer.

As we have already said, this error occurs due to a number of the tables used by Horde that are missing from the user’s Horde SQLite database.

Therefore, we tried to create the missing horde files for the particular user.  So our Support Engineers check the customer’s Cpanel error log.

And the log like this below.

[2019-06-22][webmaild] The subprocess (php) exited with an error: The subprocess reported error number 1 when it ended. at /usr/local/cpanel/Cpanel/Server/Handlers/SubProcess.pm line 251.
Cpanel::Server::Handlers::SubProcess::_report_subprocess_errors(Cpanel::Server::Handlers::SubProcess=HASH(0x221ae98)) called at /usr/local/cpanel/Cpanel/Server/Handlers/SubProcess.pm line 109
Cpanel::Server::Handlers::SubProcess::handler(Cpanel::Server::Handlers::SubProcess=HASH(0x221ae98), "subprocess_name", "php", "subprocess_pid_to_reap", 10417, "subprocess_read_handle", IO::Handle=GLOB(0x221ac88), "subprocess_write_handle", ...) called at cpsrvd.pl line 6658
cpanel::cpsrvd::cgiHandler("app", "php", "document", "./horde/login.php") called at cpsrvd.pl line 6456
cpanel::cpsrvd::phpHandler("document", "./horde/login.php") called at cpsrvd.pl line 5568
cpanel::cpsrvd::dodoc_webmaild() called at cpsrvd.pl line 1678
cpanel::cpsrvd::dodoc(HASH(0x1337ea0)) called at cpsrvd.pl line 1452
cpanel::cpsrvd::handle_one_connection(8) called at cpsrvd.pl line 893

Therefore to resolve this error we renamed the horde.sqlite file from .cphorde directory.

Then, we used this below command to rename the file of the particular user.

mv /home/username/.cphorde/horde.sqlite /home/username/.cphorde/horde.sqlite-bk

After this, we ran the below command to recreate the needed tables.

/usr/local/cpanel/bin/update_horde_config --user=username

Thus, it fixed the error for the customers.

[Need more assistance to solve the error SQLSTATE[HY000]: General error: 1 no such table error? We’ll help you]

Conclusion

In short, the error occurs when trying to change the mail account from Roundcube to Horde. Also, the error is due to a number of the tables used by Horde that are missing from the user’s Horde SQLite database. In today’s write-up, we saw how our Support Engineers fix this error for our customers.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

var google_conversion_label = «owonCMyG5nEQ0aD71QM»;

I have the same problem executing a test with dusk and even though I have RefreshDatabase implemented in the test I continue with the problem … could someone help me?

Here is the code of the test:
CartTest.php

<?php

namespace TestsBrowser;

use IlluminateFoundationTestingDatabaseMigrations;
use LaravelDuskBrowser;
use TestsBrowserPagesCartPage;
use TestsBrowserPagesProductShowPage;
use TestsDuskTestCase;
use VaniloFrameworkModelsProduct;
use VaniloProductModelsProductState;

class CartTest extends DuskTestCase
{
    use DatabaseMigrations;

    private $productA;

    private $productB;

    public function setUp() :void
    {
        parent::setUp();

        $this->productA = Product::create([
            'name'  => 'Fiat Punto',
            'sku'   => 'FTA-PUNTO',
            'state' => ProductState::ACTIVE(),
            'price' => 4500
        ]);

        $this->productB = Product::create([
            'name'  => 'Dacia Sandero',
            'sku'   => 'DCA-SANDERO',
            'state' => ProductState::ACTIVE(),
            'price' => 7900
        ]);
    }

    /** @test */
    public function it_can_open_cart()
    {
        $this->browse(function (Browser $browser) {
            $browser
                ->visit(new CartPage())
                ->assertSee('Your cart is empty');
        });
    }

    /** @test */
    public function it_can_use_cart_properly()
    {
        $this->browse(function (Browser $browser) {
            $browser
                ->visit(new ProductShowPage($this->productA))
                ->addToCart()
                ->visit(new ProductShowPage($this->productA))
                ->addToCart()
                ->visit(new ProductShowPage($this->productB))
                ->addToCart()
                ->visit(new CartPage())
                ->assertSourceHas('name="qty" value="1"')
                ->assertSourceHas('name="qty" value="2"')
                ->assertSee($this->productA->name)
                ->assertSee($this->productB->name)
                ->assertSee(format_price($this->productA->price * 2))
                ->assertSee(format_price($this->productB->price))
                ->assertSee(format_price($this->productA->price * 2 + $this->productB->price))
                ->deleteFromCart($this->productA)
                ->assertDontSee($this->productA->name);
        });
    }
}

PagesProductShowPage.php

<?php

namespace TestsBrowserPages;

use LaravelDuskBrowser;
use LaravelDuskPage;
use VaniloFrameworkModelsProduct;

class ProductShowPage extends Page
{
    /** @var Product */
    private $product;

    /**
     * ProductShowPage constructor.
     *
     * @param Product $product
     */
    public function __construct(Product $product)
    {
        $this->product = $product;
    }

    /**
     * Get the URL for the page.
     *
     * @return string
     */
    public function url()
    {
        return route('product.show', $this->product);
    }

    /**
     * Assert that the browser is on the page.
     *
     * @param  Browser $browser
     *
     * @return void
     */
    public function assert(Browser $browser)
    {
        $browser->assertSee($this->product->name);
    }

    public function addToCart(Browser $browser)
    {
        $browser->press("Add to cart");
    }
}

611 votes

1 answers

Get the solution ↓↓↓

I have created the following unit test:

    <?php

    namespace TestsUnit;

    use TestsTestCase;
    use AppUser;
    use AppOrganization;

    class UserTest extends TestCase
    {
        public function testUserHasOwnedOrganization()
        {
            $user = factory(User::class)->create();
            $organization = factory(Organization::class)->create([
                'organizer_id' => $user->id,
            ]);

            $this->assertContains($organization, $user->owned_organizations);
        }
    }

When I run it, I get:

SQLSTATE[HY000]: General error: 1 no such table: users

However, when I open upphp artisan tinker:

>>> factory(AppUser::class)->create()
=> AppUser {#3048
     name: "Margret Armstrong",
     email: "[email protected]",
     email_verified_at: "2020-05-18 01:22:30",
     updated_at: "2020-05-18 01:22:30",
     created_at: "2020-05-18 01:22:30",
     id: 1,
   }

So clearly the factory works and the table exists.

What’s going on here?

Thanks,

2021-10-25

Write your answer


269

votes

Answer

Solution:

You will need to migrate the DB when you run the test one way or another.

A common way is to utilize theRefreshDatabase trait.

<?php

namespace TestsUnit;

use TestsTestCase;
use AppUser;
use AppOrganization;
use IlluminateFoundationTestingRefreshDatabase;

class UserTest extends TestCase
{
    use RefreshDatabase;

    public function testUserHasOwnedOrganization()
    {
        $user = factory(User::class)->create();
        $organization = factory(Organization::class)->create([
            'organizer_id' => $user->id,
        ]);

        $this->assertContains($organization, $user->owned_organizations);
    }
}

See if that helps you out.

You can find more information about it here:
https://laravel.com/docs/7.x/database-testing


Share solution ↓

Additional Information:

Date the issue was resolved:

2021-10-25

Link To Source

Link To Answer
People are also looking for solutions of the problem: foreign key constraint is incorrectly formed laravel

Didn’t find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.


Similar questions

Find the answer in similar questions on our website.

Понравилась статья? Поделить с друзьями:
  • Sqlstate 42703 undefined column 7 error
  • Sqlstate 42501 insufficient privilege 7 error permission denied
  • Sqlstate 42000 ошибка sql
  • Sqlstate 42000 ошибка 50000
  • Sqlstate 42000 ошибка 1934