


MySQL - RPM method to install MySQL5.6 code examples detailed explanation
Install MySQL5.6 in RPM mode
1. Check MySQL and related RPM packages
Check MySQL and related RPM packages to see if they are installed. If they are installed, then Remove (rpm -e name)
[root@localhost ~]# rpm -qa | grep -i mysql mysql-libs-5.1.66-2.el6_3.x86_64 [root@localhost ~]# yum -y remove mysql-libs*
2. Download the rpm package
Download the RPM package corresponding to Linux, such as the RPM package corresponding to CentOS6.4_64, as follows:
[root@localhost rpm]# ll total 74364 -rw-r--r--. 1 root root 18442536 Dec 11 20:19 MySQL-client-5.6.15-1.el6.x86_64.rpm -rw-r--r--. 1 root root 3340660 Dec 11 20:06 MySQL-devel-5.6.15-1.el6.x86_64.rpm -rw-r--r--. 1 root root 54360600 Dec 11 20:03 MySQL-server-5.6.15-1.el6.x86_64.rpm
3. Install MySQL
[root@localhost rpm]# rpm -ivh MySQL-server-5.6.15-1.el6.x86_64.rpm [root@localhost rpm]# rpm -ivh MySQL-devel-5.6.15-1.el6.x86_64.rpm [root@localhost rpm]# rpm -ivh MySQL-client-5.6.15-1.el6.x86_64.rpm #修改配置文件位置 [root@localhost rpm]# cp /usr/share/mysql/my-default.cnf /etc/my.cnf
4. Initialize MySQL and set password
[root@localhost rpm]# /usr/bin/mysql_install_db [root@localhost rpm]# service mysql start [root@localhost rpm]# cat /root/.mysql_secret #查看root账号密码 # The random password set for the root user at Wed Dec 11 23:32:50 2013 (local time): qKTaFZnl [root@localhost ~]# mysql -uroot –pqKTaFZnl mysql> SET PASSWORD = PASSWORD('123456'); #设置密码为123456 mysql> exit [root@localhost ~]# mysql -uroot -p123456
5. Allow remote login
mysql> use mysql; mysql> select host,user,password from user; +-----------------------+------+-------------------------------------------+ | host | user | password | +-----------------------+------+-------------------------------------------+ | localhost | root | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 | | localhost.localdomain | root | *1237E2CE819C427B0D8174456DD83C47480D37E8 | | 127.0.0.1 | root | *1237E2CE819C427B0D8174456DD83C47480D37E8 | | ::1 | root | *1237E2CE819C427B0D8174456DD83C47480D37E8 | +-----------------------+------+-------------------------------------------+ mysql> update user set password=password('123456') where user='root'; mysql> update user set host='%' where user='root' and host='localhost'; mysql> flush privileges; mysql> exit
6. Set up auto-start at boot
[root@localhost ~]# chkconfig mysql on [root@localhost ~]# chkconfig --list | grep mysql mysql 0:off 1:off 2:on 3:on 4:on 5:on 6:off
7. The default installation location of MySQL
/var/lib/mysql/ #数据库目录 /usr/share/mysql #配置文件目录 /usr/bin #相关命令目录 /etc/init.d/mysql #启动脚本
8. Modify characters Set and data storage path
Configure the /etc/my.cnf file, modify the data storage path, mysql.sock path and the default encoding utf-8.
[client] password = 123456 port = 3306 default-character-set=utf8 [mysqld] port = 3306 character_set_server=utf8 character_set_client=utf8 collation-server=utf8_general_ci #(注意linux下mysql安装完后是默认:表名区分大小写,列名不区分大小写; 0:区分大小写,1:不区分大小写) lower_case_table_names=1 #(设置最大连接数,默认为 151,MySQL服务器允许的最大连接数16384; ) max_connections=1000 [mysql] default-character-set = utf8
9. View character set
show variables like '%collation%'; show variables like '%char%';
The above is the detailed content of MySQL - RPM method to install MySQL5.6 code examples detailed explanation. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

MySQL is an open source relational database management system, mainly used to store and retrieve data quickly and reliably. Its working principle includes client requests, query resolution, execution of queries and return results. Examples of usage include creating tables, inserting and querying data, and advanced features such as JOIN operations. Common errors involve SQL syntax, data types, and permissions, and optimization suggestions include the use of indexes, optimized queries, and partitioning of tables.

MySQL's position in databases and programming is very important. It is an open source relational database management system that is widely used in various application scenarios. 1) MySQL provides efficient data storage, organization and retrieval functions, supporting Web, mobile and enterprise-level systems. 2) It uses a client-server architecture, supports multiple storage engines and index optimization. 3) Basic usages include creating tables and inserting data, and advanced usages involve multi-table JOINs and complex queries. 4) Frequently asked questions such as SQL syntax errors and performance issues can be debugged through the EXPLAIN command and slow query log. 5) Performance optimization methods include rational use of indexes, optimized query and use of caches. Best practices include using transactions and PreparedStatemen

Apache connects to a database requires the following steps: Install the database driver. Configure the web.xml file to create a connection pool. Create a JDBC data source and specify the connection settings. Use the JDBC API to access the database from Java code, including getting connections, creating statements, binding parameters, executing queries or updates, and processing results.

MySQL is chosen for its performance, reliability, ease of use, and community support. 1.MySQL provides efficient data storage and retrieval functions, supporting multiple data types and advanced query operations. 2. Adopt client-server architecture and multiple storage engines to support transaction and query optimization. 3. Easy to use, supports a variety of operating systems and programming languages. 4. Have strong community support and provide rich resources and solutions.

The main role of MySQL in web applications is to store and manage data. 1.MySQL efficiently processes user information, product catalogs, transaction records and other data. 2. Through SQL query, developers can extract information from the database to generate dynamic content. 3.MySQL works based on the client-server model to ensure acceptable query speed.

The process of starting MySQL in Docker consists of the following steps: Pull the MySQL image to create and start the container, set the root user password, and map the port verification connection Create the database and the user grants all permissions to the database

Laravel is a PHP framework for easy building of web applications. It provides a range of powerful features including: Installation: Install the Laravel CLI globally with Composer and create applications in the project directory. Routing: Define the relationship between the URL and the handler in routes/web.php. View: Create a view in resources/views to render the application's interface. Database Integration: Provides out-of-the-box integration with databases such as MySQL and uses migration to create and modify tables. Model and Controller: The model represents the database entity and the controller processes HTTP requests.

The key to installing MySQL elegantly is to add the official MySQL repository. The specific steps are as follows: Download the MySQL official GPG key to prevent phishing attacks. Add MySQL repository file: rpm -Uvh https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm Update yum repository cache: yum update installation MySQL: yum install mysql-server startup MySQL service: systemctl start mysqld set up booting
