MySQL Tutorial
MySQL Installation and Configuration
MySQL Database Operations
Database Design
MySQL Data Types
MySQL Storage Engines
MySQL Basic Operations of Tables
MySQL Constraints
MySQL Operators
MySQL Function
MySQL Manipulate Table Data
MySQL View
MySQL Indexes
MySQL Stored Procedure
MySQL Trigger
MySQL Transactions
MySQL Character Set
MySQL User Management
MySQL Database Backup and Recovery
MySQL Log
MySQL Performance Optimization
rpm -ivh {-file-name}
.rpm -ivh mysql-community-common-5.7.29-1.el6.x86_64.rpm rpm -ivh mysql-community-libs-5.7.29-1.el6.x86_64.rpm rpm -ivh mysql-community-client-5.7.29-1.el6.x86_64.rpm rpm -ivh mysql-community-server-5.7.29-1.el6.x86_64.rpmIn ivh, the i-install parameter indicates one or more RPM packages after installation; the v-verbose parameter indicates that detailed information is displayed during the installation process; the h-hash parameter indicates that "#" is used to display the installation progress.
service mysql startTip: Starting from MySQL 5.0, the service name of MySQL has been changed to mysql instead of mysqld of 4.*.
service mysql start | stop | restart | statusThe meanings of the above parameters are as follows:
cat /var/log/mysqld.log | grep 'temporary password is generated'
mysql -uroot -p
[root@localhost ~]# mysql -uroot -p Enter password: **** Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1 Server version: 5.7.29 MySQL Community Server (GPL) Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.The above descriptive statement is described as follows:
Tip: When the description information shown in the above figure appears in the window, and the command prompt changes to "mysql>", it indicates that the MySQL server has been successfully logged in, and the database can be operated.
set password='testroot';
folder | folder contents |
---|---|
/usr/bin | Clients and scripts (commands such as mysqladmin, mysqldump, etc.) |
/usr/sbin | mysqld server |
/var/lib/mysql | log files, socket files and databases |
/usr/share/info | Manual of Information Format |
/usr/share/man | UNIX help pages |
/usr/include/mysql | head File |
/usr/lib/mysql | library |
/usr/share/mysql | Error messages, character sets, installation and configuration files, etc. |
/etc/rc.d/init.d/ | The mysql directory for startup script files that can be used to start and stop the MySQL service |
cp /usr/share/mysql/my-large.cnf /etc/my.cnf vi /etc/my.cnfThe first line of commands can complete the work of copying and renaming, and the second line of commands can edit my.cnf.
:w
you can enter it. If you don't want to save and exit directly, :q!
you can enter it. Setting Up MySQL Server on Linux:
sudo apt update sudo apt install mysql-server sudo systemctl start mysql
sudo yum install mysql-server sudo systemctl start mysqld
Configure MySQL on Ubuntu/Linux:
mysql_secure_installation
command to configure MySQL settings, set the root password, and secure the installation.sudo mysql_secure_installation
MySQL Installation and Configuration in CentOS:
mysql_secure_installation
for configuration.sudo yum install mysql-server sudo systemctl start mysqld sudo mysql_secure_installation
Securing MySQL Installation on Linux:
mysql_secure_installation
to secure the MySQL installation by setting a strong root password, removing anonymous users, and disabling remote root login.sudo mysql_secure_installation
Basic MySQL Setup on Debian:
mysql_secure_installation
.sudo apt update sudo apt install mysql-server sudo mysql_secure_installation