Learning Focus
Use this lesson to understand Initial Server Configuration with practical syntax and examples.
Module 5: Initial Server Configuration
Basic Security Setup
a. Root Password Configuration
ALTER USER 'root'@'localhost' IDENTIFIED BY 'NewStrongPassword!123';
b. Anonymous User Removal
DROP USER ''@'localhost';
c. Test Database Removal
DROP DATABASE IF EXISTS test;
Network Configuration
a. Bind Address
# my.cnf/my.ini
[mysqld]
bind-address = 127.0.0.1 # Only local connections
b. Port Configuration
[mysqld]
port = 3306
Memory Allocation
a. Buffer Pool Size (InnoDB)
[mysqld]
innodb_buffer_pool_size = 1G # For 4GB RAM machine
b. Connection Settings
[mysqld]
max_connections = 200
wait_timeout = 600
Logging Configuration
a. Error Log
[mysqld]
log_error = /var/log/mysql/error.log
b. Slow Query Log
[mysqld]
slow_query_log = 1
slow_query_log_file = /var/log/mysql/slow-queries.log
long_query_time = 2
Storage Engine Defaults
[mysqld]
default-storage-engine = InnoDB
Character Set Configuration
[mysqld]
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci
Post-Configuration Steps
a. Flush Privileges
FLUSH PRIVILEGES;
b. Restart Service
sudo systemctl restart mysql # Linux
c. Verify Configuration
SHOW VARIABLES LIKE '%buffer%';
Next Material Confirmation
I'll continue creating materials according to your curriculum's numbered structure. Next would be:
2. MySQL Data Types
a. Numeric Data Types
-> First subtopic: INT
(Following your instruction, I'll create material for INT only first)
Concept Map
flowchart LR
A[Schema Context] --> B[Initial Server Configuration]
B --> C[Query Pattern]
C --> D[Validation]
D --> E[Production Use]
Common Pitfalls
| Pitfall | Consequence | Prevention |
|---|---|---|
| Executing queries without validating sample rows | Logic errors reach production data or reports | Start with SELECT ... LIMIT 10 and inspect edge cases |
| Ignoring NULL and duplicate behavior | Aggregations and filters return misleading results | Test with NULL, duplicates, and empty sets explicitly |
| Using advanced syntax before checking schema | Queries fail due to missing columns/indexes | Verify structure with DESCRIBE table_name; and adapt query design |
Quick Reference
# Check client and server availability
mysql --version
systemctl status mysql
# Open MySQL shell
mysql -u root -p
What's Next
- Previous: Mysql workbench - Review the previous lesson to reinforce context.
- Module Overview - Return to this module index and choose another related lesson.