Analyze the installation and use of mysql (Collection)
In the previous article "Teach you step by step how to enable https and http2 for the site (with code)", I introduced you how to enable https and http2 for the site. The following article will help you understand the installation and use of mysql. Please keep it in your collection~
#1 先去https://repo.mysql.com/ 下载最新的repo源
$ wget https://repo.mysql.com/mysql80-community-release-sles12-2.noarch.rpm
#2 安装mysql80-community-release-sles12-2.noarch.rpm包
$ sudo rpm -ivh mysql80-community-release-sles12-2.noarch.rpm
#假如报错提示冲突的话, 先查询下是不是已经安装过了
$ rpm -qa | grep mysql
#有的话干掉他 --nodeps 强制卸载
$ rpm -e xxx (--nodeps) #xxx为冲突的rpm名称
Copy after login
Install mysql#1 先去https://repo.mysql.com/ 下载最新的repo源 $ wget https://repo.mysql.com/mysql80-community-release-sles12-2.noarch.rpm #2 安装mysql80-community-release-sles12-2.noarch.rpm包 $ sudo rpm -ivh mysql80-community-release-sles12-2.noarch.rpm #假如报错提示冲突的话, 先查询下是不是已经安装过了 $ rpm -qa | grep mysql #有的话干掉他 --nodeps 强制卸载 $ rpm -e xxx (--nodeps) #xxx为冲突的rpm名称
$ sudo yum install mysql-community-server #安装
$ service mysqld start #启动
$ sudo service mysqld status #检查MySQL服务状态
$ sudo grep 'temporary password' /var/log/mysqld.log #查看初始密码
$ mysqld -V #查看版本
Copy after login
Reset password$ sudo yum install mysql-community-server #安装 $ service mysqld start #启动 $ sudo service mysqld status #检查MySQL服务状态 $ sudo grep 'temporary password' /var/log/mysqld.log #查看初始密码 $ mysqld -V #查看版本
$ mysql -u root #需要输入初始密码
#修改root登录密码,注意要切换到mysql数据库,使用use mysql
$ ALTER USER 'root'@'localhost' IDENTIFIED BY '密码';
Copy after login
Remote login$ mysql -u root #需要输入初始密码 #修改root登录密码,注意要切换到mysql数据库,使用use mysql $ ALTER USER 'root'@'localhost' IDENTIFIED BY '密码';
# 需要更改权限才能实现远程连接MYSQL数据库
$ mysql -h localhost -uroot -p #输入密码登录
mysql> use mysql; #此DB存放MySQL的各种配置信息
mysql> select host,user from user; #查看用户的权限情况
mysql> select host, user, password from user;
mysql> update user set host = '%' where user ='root';
# %表示是所有的外部机器,如果指定某一台机,就将%改为相应的机器名;‘root’则是指要使用的用户名
mysql> flush privileges; #运行此句才生效,或者重启MySQL
Copy after login
# 需要更改权限才能实现远程连接MYSQL数据库 $ mysql -h localhost -uroot -p #输入密码登录 mysql> use mysql; #此DB存放MySQL的各种配置信息 mysql> select host,user from user; #查看用户的权限情况 mysql> select host, user, password from user; mysql> update user set host = '%' where user ='root'; # %表示是所有的外部机器,如果指定某一台机,就将%改为相应的机器名;‘root’则是指要使用的用户名 mysql> flush privileges; #运行此句才生效,或者重启MySQL
The last step is to add rules to open the 3306 port in the server firewall configurationFAQER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server; consider upgrading MySQL client
mysql -u root -p #输入密码登录 #yourpassword 是你的数据库账户密码,root和host也是 ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '123456'; #大意是8.0.4开始mysql引入一个caching_sha2_password模块作为默认身份验证插件,数据库连接时验证身份的工作方式(handshake process)会与以往不同。
mysql -u root -p mysql> use mysql; mysql> select user,host from user; +------------------+-----------+ | user | host | +------------------+-----------+ | root | % | | admin | localhost | | mysql.infoschema | localhost | | mysql.session | localhost | | mysql.sys | localhost | | zhangj | localhost | +------------------+-----------+ #注意root,host是'%',你可能执行的是: ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123'; # 改成: ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '123';
The above is the detailed content of Analyze the installation and use of mysql (Collection). 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











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.

I encountered a tricky problem when developing a small application: the need to quickly integrate a lightweight database operation library. After trying multiple libraries, I found that they either have too much functionality or are not very compatible. Eventually, I found minii/db, a simplified version based on Yii2 that solved my problem perfectly.

MySQL and phpMyAdmin are powerful database management tools. 1) MySQL is used to create databases and tables, and to execute DML and SQL queries. 2) phpMyAdmin provides an intuitive interface for database management, table structure management, data operations and user permission management.

Compared with other programming languages, MySQL is mainly used to store and manage data, while other languages such as Python, Java, and C are used for logical processing and application development. MySQL is known for its high performance, scalability and cross-platform support, suitable for data management needs, while other languages have advantages in their respective fields such as data analytics, enterprise applications, and system programming.

Article summary: This article provides detailed step-by-step instructions to guide readers on how to easily install the Laravel framework. Laravel is a powerful PHP framework that speeds up the development process of web applications. This tutorial covers the installation process from system requirements to configuring databases and setting up routing. By following these steps, readers can quickly and efficiently lay a solid foundation for their Laravel project.

MySQL is suitable for web applications and content management systems and is popular for its open source, high performance and ease of use. 1) Compared with PostgreSQL, MySQL performs better in simple queries and high concurrent read operations. 2) Compared with Oracle, MySQL is more popular among small and medium-sized enterprises because of its open source and low cost. 3) Compared with Microsoft SQL Server, MySQL is more suitable for cross-platform applications. 4) Unlike MongoDB, MySQL is more suitable for structured data and transaction processing.
