Install MySQL 5.7 on Linux
· One min read
MySQL 5.7 is an older release and should be used only when application compatibility requires it. Prefer a supported current release for new systems.
Create a dedicated service account and directories, install the package or official binary distribution, then initialize the data directory:
mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql
Record the temporary root password from the error log. Configure my.cnf with the correct basedir, datadir, socket, port, character set, and log paths. Start the service and change the root password immediately:
ALTER USER 'root'@'localhost' IDENTIFIED BY 'a-long-random-password';
Do not expose port 3306 publicly. Restrict accounts by host, remove anonymous users and test databases, enable backups, monitor disk usage, and verify the upgrade path because MySQL 5.7 has reached end of life.