Lanka Developers Community

    Lanka Developers

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Shop
    1. Home
    2. Kasun Rathnayake
    • Profile
    • Following 4
    • Followers 0
    • Topics 5
    • Posts 16
    • Best 3
    • Controversial 0
    • Groups 1

    Kasun Rathnayake

    @Kasun Rathnayake

    Web Development

    3
    Reputation
    12
    Profile views
    16
    Posts
    0
    Followers
    4
    Following
    Joined Last Online

    Kasun Rathnayake Unfollow Follow
    Web Development

    Best posts made by Kasun Rathnayake

    • RE: mysql: ERROR 1524 (HY000): Plugin 'mysql-native-password' is not loaded

      @root this worked brother

      thank you so much

      posted in Mac OSX
      Kasun Rathnayake
      Kasun Rathnayake
    • Problem on migration : products category foreign key

      on laravel8 framework , can anyone help me with this i also used ,

      this way but still it doesn't work
      https://stackoverflow.com/questions/22615926/migration-cannot-add-foreign-key-constraint

      Cannot add foreign key constraint..

      Error is as below
      
      SQLSTATE[HY000]: General error: 1215 Cannot add foreign key constraint (SQL: alter table `products` add constraint `products_category_id_foreign` foreign key (`category_id`) references `categories` (`id`))
      
        at vendor/laravel/framework/src/Illuminate/Database/Connection.php:678
          674▕         // If an exception occurs when attempting to run a query, we'll format the error
          675▕         // message to include the bindings with SQL, which will make this exception a
          676▕         // lot more helpful to the developer instead of just the database's errors.
          677▕         catch (Exception $e) {
        ➜ 678▕             throw new QueryException(
          679▕                 $query, $this->prepareBindings($bindings), $e
          680▕             );
          681▕         }
          682▕
      
            +9 vendor frames
        10  database/migrations/2021_01_19_074944_create_products_table.php:38
            Illuminate\Support\Facades\Facade::__callStatic("create")
      
            +21 vendor frames
        32  artisan:37
            Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
      
      

      code on the migration

      <?php
      
      use Illuminate\Database\Migrations\Migration;
      use Illuminate\Database\Schema\Blueprint;
      use Illuminate\Support\Facades\Schema;
      
      class CreateProductsTable extends Migration
      {
          /**
           * Run the migrations.
           *
           * @return void
           */
          public function up()
          {
              Schema::create('products', function (Blueprint $table) {
                  $table->id();
                  $table->string('name');
                  $table->string('slug')->unique();
                  $table->string('Short_Description')->nullable();
                  $table->string('description');
                  $table->decimal('regular_price');
                  $table->decimal('sale_price')->nullable();
                  $table->string('SKU');
                  $table->enum('stock_status',['instock','outstock']);
                  $table->boolean('Featured')->default(false);
                  $table->unsignedInteger('quantity')->default(10);
                  $table->string('image')->nullable();
                  $table->string('images')->nullable();
                  $table->integer('category_id')->nullable()->unsigned();
                  $table->foreign('category_id')->references('id')->on('categories')->onDelete('cascade');
                  $table->timestamps();
              });
          }
      
          /**
           * Reverse the migrations.
           *
           * @return void
           */
          public function down()
          {
              Schema::dropIfExists('products');
          }
      }
      
      
      posted in Laravel Framework
      Kasun Rathnayake
      Kasun Rathnayake
    • RE: Flutter Camping App UI

      superb good job bro

      posted in Mobile Application Development
      Kasun Rathnayake
      Kasun Rathnayake

    Latest posts made by Kasun Rathnayake

    • RE: What is the best javascript framework to learn?

      typescript ..

      posted in Front-End Development
      Kasun Rathnayake
      Kasun Rathnayake
    • Any one know to get water electricity (LECO,SLT ) payment api for laravel

      to get online payment for electricity bill online , water and mobile reload + Slt can some help me with this ..

      or guide me

      thanks

      posted in Laravel Framework
      Kasun Rathnayake
      Kasun Rathnayake
    • RE: mysql: ERROR 1524 (HY000): Plugin 'mysql-native-password' is not loaded

      @root this worked brother

      thank you so much

      posted in Mac OSX
      Kasun Rathnayake
      Kasun Rathnayake
    • RE: mysql: ERROR 1524 (HY000): Plugin 'mysql-native-password' is not loaded

      @root yes ,
      i tried to remove it and install back but error comes again

      same error

      posted in Mac OSX
      Kasun Rathnayake
      Kasun Rathnayake
    • RE: mysql: ERROR 1524 (HY000): Plugin 'mysql-native-password' is not loaded

      @root brother on mac ..

      this is not working when i use this command the above comment comes ...
      this error

      ERROR 1524 (HY000): Plugin 'mysql-native-password' is not loaded
      
      posted in Mac OSX
      Kasun Rathnayake
      Kasun Rathnayake
    • mysql: ERROR 1524 (HY000): Plugin 'mysql-native-password' is not loaded

      ERROR 1524 (HY000): Plugin 'mysql_native_(Password)' is not loaded

      I wasn't prompted to set a root password during the installation and so whenever I tried to use mysql via the mysql -u root -p command. I got this error => Access denied for user 'root'@'localhost'.

      So I searched stack overflow and found an answer that involved setting the authentication plugin to mysql_native_password. the query looked something like this...

      UPDATE user SET plugin="mysql_native_password";
      However, for some reason I typed the command manually instead of copying it and I seem to have written mysql-native-password instead of mysql_native_password (stupid me!!!)

      now I tried to access the mysql shell in various ways but I always get the following error!

      ERROR 1524 (HY000): Plugin 'mysql-native-password' is not loaded

      Tried with safe mode : sudo mysqld_safe --skip-grant-tables &
      also happens to be the same problem ,

      Screenshot 2021-03-07 at 1.04.51 PM.png

      posted in Mac OSX
      Kasun Rathnayake
      Kasun Rathnayake
    • RE: Problem on migration : products category foreign key

      @dev_lak thanks bro i checked them too , but not working as said on the forums , its like sql dont get foreign keys , but also i tried out there solutions too but not working.

      posted in Laravel Framework
      Kasun Rathnayake
      Kasun Rathnayake
    • RE: Problem on migration : products category foreign key

      @root said in Problem on migration : products category foreign key:

      show me your database/migrations folder

      Screenshot 2021-01-21 at 8.36.08 PM.png

      posted in Laravel Framework
      Kasun Rathnayake
      Kasun Rathnayake
    • RE: Problem on migration : products category foreign key

      @nubelle did it bro still the same

      posted in Laravel Framework
      Kasun Rathnayake
      Kasun Rathnayake
    • Problem on migration : products category foreign key

      on laravel8 framework , can anyone help me with this i also used ,

      this way but still it doesn't work
      https://stackoverflow.com/questions/22615926/migration-cannot-add-foreign-key-constraint

      Cannot add foreign key constraint..

      Error is as below
      
      SQLSTATE[HY000]: General error: 1215 Cannot add foreign key constraint (SQL: alter table `products` add constraint `products_category_id_foreign` foreign key (`category_id`) references `categories` (`id`))
      
        at vendor/laravel/framework/src/Illuminate/Database/Connection.php:678
          674▕         // If an exception occurs when attempting to run a query, we'll format the error
          675▕         // message to include the bindings with SQL, which will make this exception a
          676▕         // lot more helpful to the developer instead of just the database's errors.
          677▕         catch (Exception $e) {
        ➜ 678▕             throw new QueryException(
          679▕                 $query, $this->prepareBindings($bindings), $e
          680▕             );
          681▕         }
          682▕
      
            +9 vendor frames
        10  database/migrations/2021_01_19_074944_create_products_table.php:38
            Illuminate\Support\Facades\Facade::__callStatic("create")
      
            +21 vendor frames
        32  artisan:37
            Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
      
      

      code on the migration

      <?php
      
      use Illuminate\Database\Migrations\Migration;
      use Illuminate\Database\Schema\Blueprint;
      use Illuminate\Support\Facades\Schema;
      
      class CreateProductsTable extends Migration
      {
          /**
           * Run the migrations.
           *
           * @return void
           */
          public function up()
          {
              Schema::create('products', function (Blueprint $table) {
                  $table->id();
                  $table->string('name');
                  $table->string('slug')->unique();
                  $table->string('Short_Description')->nullable();
                  $table->string('description');
                  $table->decimal('regular_price');
                  $table->decimal('sale_price')->nullable();
                  $table->string('SKU');
                  $table->enum('stock_status',['instock','outstock']);
                  $table->boolean('Featured')->default(false);
                  $table->unsignedInteger('quantity')->default(10);
                  $table->string('image')->nullable();
                  $table->string('images')->nullable();
                  $table->integer('category_id')->nullable()->unsigned();
                  $table->foreign('category_id')->references('id')->on('categories')->onDelete('cascade');
                  $table->timestamps();
              });
          }
      
          /**
           * Reverse the migrations.
           *
           * @return void
           */
          public function down()
          {
              Schema::dropIfExists('products');
          }
      }
      
      
      posted in Laravel Framework
      Kasun Rathnayake
      Kasun Rathnayake