• Connect to MySQL:First, log into MySQL using the following command:
    mysql -u your_user -p

    Enter your password when prompted.

  • Convert the Database:Run the following command to convert the entire database to utf8mb4. Replace your_database_name with the actual name of your database.
    ALTER DATABASE your_database_name CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
  • Convert the Tables:After converting the database, you need to convert each table within the database:
    ALTER TABLE your_table_name CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

    Do this for each table in your database.

  • Convert the Columns (optional):If any columns within your tables need to be converted specifically, you can do so with the following command:
    ALTER TABLE your_table_name MODIFY your_column_name VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

    This will convert the column to utf8mb4.