Current Topic: 5.2.1.2. AWS MySQL EC2 User setting
You have a privilege to create a quiz (QnA) related to this subject and obtain creativity score...
5.2.1.2. AWS MySQL EC2 User setting
Login to the EC2-USER shell window at AWS.Amason.com
// get root access
>sudo -i
// try to start mysql - check if installed in your area
>service mysqld start
// if not, install mysql-server
>yum install mysql-server
// start the server
>service mysqld start
// make a password for the root account (Note that initial password usually is not set for the root, so we do not need to say -p at the end and we do ot need to provide default password, which is "" - nothing)
>mysqladmin -u root password '{new_password}'
// This command might fail, because the assumption is "No initial password for root".
// If this is not a case use the following to get "temporary password" provided by default in the beginning.
// Then use this password
>mysqladmin -u root -p
Enter Password:{provide that temporary password}
// If you use MySQL 5.7.6 and later:
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass';
// If you use MySQL 5.7.5 and earlier:
mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('MyNewPass');
// MySQL client will start and you can alter this root password and provide other settings
// Note that the password has Capital and small letter, a number and a special character.
//Run MySQL as root and providing the password:
>mysql -u root -p
Enter Password: {new_password}
// create a new schema (database) and grant privileges to a new user
mysql>create database {db name};
mysql> CREATE USER '{userName}'@'localhost' IDENTIFIED BY '{password}'
-> ;
Query OK, 0 rows affected (0.03 sec)
Was it clear so far?
mysql> GRANT INSERT, UPDATE, DELETE ON Books TO userName}t@localhost;
or
mySql>grant all privileges on {db name}.* to '{user_name}'@'localhost';
mySql>show databases;
mysql> show databases;
+------------------------+
| Database |
+------------------------+
| information_schema |
| {your DB_name} |
| mysql |
| performance_schema |
| test |
+------------------------+
// Create a table with field names and data types - see a sample below
mysql> create table {db_name}.{table_name} ({table_name_ID} INTEGER NOT NULL PRIMARY KEY, {field1} text, {field2} varchar(399), UPDATEDBY varchar(60, UPDATEDTIME TIMESTAMP);
Make MySQL DB case insensitive to table names
While moving to LINUX environment it is possible that MySQL becomes picky.
The same table names that worked before are "not found". MySQL can be case sensitive to table names.
Here is how to make it behave, turn off case sensitivity.
//Edit my.cnf - configuration file
sudo -i
vi /etc/my.cnf
// the my.cnf file can be in another place, but most common place in AWS EC2 environment is under /etc
// If you prefer MySql to be not case sensitive to the table names
// Underneath the [mysqld] section.add:
lower_case_table_names = 1
// increase wait_timeout value to 999999 sec so JDBC is not closing connections too soon
// also provide big enough: max_allowed_packet = 128M
[mysqld]
wait_timeout=9999999
interactive_timeout=9999999
max_allowed_packet = 128M
//Restart mysql