Friday 8 October 2021

aws light sail pont to a domain in godaddy

Step 1: go to light sail dashboards and
 

Step 2: Assign static ip to the instance
 

Step 3: create dns zone with that static ip

This will  provide Name server;

Step 4: Now u can also add A record for subdomain ex: www for your domain and use @ to pint the main domain

ex: @ to point your domain.com

      www to pint your www.domain.com


Step 5: now go to domain where u baught   (example godaddy dashboards)
    you can see the DNS >
 

Step 6 : Now change Name server > and add the name provided by aws

That is it; dns propagation take min 24 hrs
so it will take 24 hrs min to see the changes the url points to new aws hosting

Note: 

The A record maps a name to one or more IP addresses when the IP are known and stable.
The CNAME record maps a name to another name. It should only be used when there are no other records on that name.
The ALIAS record maps a name to another name, but can coexist with other records on that name.


Thursday 7 October 2021

Error in query (1267): Illegal mix of collations (utf8mb4_unicode_ci,IMPLICIT) and (utf8mb4_0900_ai_ci,IMPLICIT) for operation '='

SET SESSION default_collation_for_utf8mb4 = 'utf8mb4_unicode_ci'


The Unicode organization has been evolving the specification over the years. Here are the mappings from its "versions" to MySQL Collations:

4.0   _unicode_
5.20  _unicode_520_
9.0   _0900_

The suffix (MySQL doc):

_bin      -- just compare the bits; don't consider case folding, accents, etc
_ci       -- explicitly case insensitive (A=a) and implicitly accent insensitive (a=á)
_ai_ci    -- explicitly case insensitive and accent insensitive
_as (etc) -- accent-sensitive (etc)


Performance:

_bin         -- simple, fast
_general_ci  -- fails to compare multiple letters; eg ss=ß, so somewhat fast
...          -- slower
_900_        -- (8.0) much faster because of a rewrite

From mysql:8 default collation
collation_connection    utf8mb4_0900_ai_ci
collation_database    utf8mb4_0900_ai_ci
collation_server    utf8mb4_0900_ai_ci

So we can go with utf8mb4_0900_ai_ci
    because 1. Unicode 9.0 specification
            2. introduced in mydql 8
            3. reported faster Performance    


Step 1 - data base alter collate

ALTER DATABASE `dbname` COLLATE utf8mb4_unicode_ci

Step 2 - alter collate of table 

 ALTER TABLE tablename  COLLATE 'utf8mb4_0900_ai_ci';

 

Error in query (1292): Incorrect datetime value

Run this query - this work for a session
 

SET sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION';


best way is to set in mysql .cnf files


$ sudo vi /etc/mysql/mysql.conf.d/mysqld.cnf

Below [mysqld] section add sql_mode command Example:

[mysqld]
sql_mode = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION'

Then validate config

sudo mysqld --validate-config
OR
sudo mysqld --defaults-file=/etc/mysql/my.cnf --validate-config

No output, then everything good.

Then
sudo service mysql restart