


This article describes MySQL - a detailed introduction to the installation of MySQL5.5 in RPM mode under CentOS. It has reference value. Let’s analyze it together.
First go to the mySQL official website download page:
http: //dev.mysql.com/downloads/mysql/#downloads
Select Platform Select Oracle & Red Hat Linux 4 & 5
to download the following three files respectively ( Since my machine is 32-bit, the following is the 32-bit version of the package. If your machine is 64-bit, please download the 64-bit version):
1. Red Hat & Oracle Linux 5 (x86, 32-bit), RPM Package
MySQL Server
2. Red Hat & Oracle Linux 5 (x86, 32-bit), RPM Package
Client Utilities
##3. Red Hat & Oracle Linux 5 (x86, 32-bit), RPM PackageDevelopment Libraries
wget -c http://cdn.mysql.com/Downloads/MySQL-5.5/MySQL-server-5.5.28-1.rhel5.i386.rpm wget -c http://cdn.mysql.com/Downloads/MySQL-5.5/MySQL-client-5.5.28-1.rhel5.i386.rpm wget -c http://cdn.mysql.com/Downloads/MySQL-5.5/MySQL-devel-5.5.28-1.rhel5.i386.rpmAfter the download is complete, start the installation:
rpm -ivh MySQL-server-5.5.28-1.rhel5.i386.rpm
rpm -ivh MySQL-client-5.5.28-1.rhel5.i386.rpm
If an error occurs during the installation:
error: Failed dependencies: libaio.so.1()(64bit) is needed by MySQL-server-5.5.28-1.rhel5.x86_64 libaio.so.1(LIBAIO_0.1)(64bit) is needed by MySQL-server-5.5.28-1.rhel5.x86_64 libaio.so.1(LIBAIO_0.4)(64bit) is needed by MySQL-server-5.5.28-1.rhel5.x86_64
is that the dependent library is missing, just install the dependent library
yum install libaio
After prompting that the installation is complete, enter mysql to see if the installation is successful
mysql
If there is no response or the following error message appears:
Indicates that the mysql service has not been started yet, enter service mysql start Start the mysql service
service mysql start
and then enter mysql. If the following prompt message appears, it means success.
Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1 Server version: 5.5.16 MySQL Community Server (GPL) Copyright (c) 2000, 2011, 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.
If an error occurs
Starting MySQL.... ERROR! The server quit without updating PID file (/var/lib/mysql/lechiexxxxx.pid).
View the log file based on the error address
The address here is /var/lib/mysql/
The log name is generally the server name.err
When I open it, I find this sentence:
[ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist 121012 15:12:05 mysqld_safe mysqld from pid file /var/lib/mysql/lechiexxxxxx.pid ended
So the table is missing.
Initialization of the execution table
/usr/bin/mysql_install_db
After execution, the startup still fails. Check the log:
[ERROR] Failed to open log (file './mysql-bin.000004', errno 13)
It should be that there is no permission. After granting mysql permission
chown -R mysql:mysql /var/lib/mysql/
Re-execute service mysql start to start the service, success!
You can start the daemon process
/usr/bin/mysqld_safe &
I usually press Enter several times to exit putty or secureCRT, and then reopen a session
[Question]
Where is mysql installed after installation? Generally in the following folders
/usr/share/mysql/ or /usr/lib/mysql/ or /var/lib/mysql/
You can pass the command:
whereis mysql
Let’s see where it is installed.
[Initialization Settings]
The MySQL installed by rpm package will not install the /etc/my.cnf file. As a solution, you only need to copy my in the /usr/share/mysql directory. -huge.cnf file to the /etc directory and rename it to my.cnf
cp /usr/share/mysql/my-huge.cnf /etc/my.cnf
[Set password]
When installing for the first time, the default password is empty. You can use the following command to modify root Password,
/usr/bin/mysqladmin -u root password 新密码XXXXX
For example: /usr/bin/mysqladmin -u root password 123456
Then log in again
mysql -u root –p新密码XXXXX
Modify the login password
This is through The mysqladmin command can be used to modify the password, or the password can be changed by modifying the library.
[Directory Description]
1. Database directory
/var/lib/mysql/
2. Configuration file
/ usr/share/mysql (mysql.server command and configuration file)
3. Related commands
/usr/bin (mysqladmin mysqldump and other commands)
4. Startup script
/etc/rc.d/init.d/ (directory of startup script file mysql)
[Start and Stop]
1. Start
After the MySQL installation is completed, the startup file mysql is in the /etc/init.d directory. Just run the following command when you need to start it.
/etc/init.d/mysql start
or
/etc/rc.d/init.d/mysql start
2. Stop
/usr/bin/mysqladmin -u root -p shutdown
3. Automatically start
1) Check whether mysql is automatically In the startup list
/sbin/chkconfig –list
2) Add MySQL to the startup service group of your system
/sbin/chkconfig – add mysql
3) Delete MySQL from the startup service group.
/sbin/chkconfig – del mysql
[Change MySQL directory]
MySQL’s default data file storage directory is /var/lib/mysql.
If you want to move the directory to /home/data, you need to perform the following steps:
1. Create the data directory under the home directory
cd /home
mkdir data
Remember to grant permissions:
chown -R mysql:mysql /home/data
2. Stop the MySQL service process :
mysqladmin -u root -p shutdown
3. Move the entire /var/lib/mysql directory to /home/data
mv /var/lib/mysql /home/data/
This will move the MySQL data file to /home/data/mysql
4. Find the my.cnf configuration file
If /etc There is no my.cnf configuration file in the / directory. Please find the *.cnf file in /usr/share/mysql/,
copy one of them to /etc/ and rename it to my.cnf). The command is as follows:
cp /usr/share/mysql/my-medium.cnf /etc/my.cnf
5、编辑MySQL的配置文件/etc/my.cnf
为保证MySQL能够正常工作,需要指明mysql.sock文件的产生位置。
修改socket=/var/lib/mysql/mysql.sock一行中等号右边的值
为:/home/mysql/mysql.sock 。操作如下:
vi my.cnf ##用vi工具编辑my.cnf文件,找到下列数据修改之 # The MySQL server [mysqld] port = 3306 #socket = /var/lib/mysql/mysql.sock ##原内容,为了更稳妥用“#”注释此行 socket = /home/data/mysql/mysql.sock #加上此行
6、修改MySQL启动脚本/etc/rc.d/init.d/mysql
最后,需要修改MySQL启动脚本/etc/rc.d/init.d/mysql,把其中datadir=/var/lib/mysql一行中,等号右边的路径改成你现在的实际存
放路径:home/data/mysql。
vi /etc/rc.d/init.d/mysql #datadir=/var/lib/mysql##注释此行 datadir=/home/data/mysql ##加上此行
7、重新启动MySQL服务
/etc/rc.d/init.d/mysql start
或用reboot命令重启Linux
如果工作正常移动就成功了,否则对照前面的7步再检查一下。
【配置远程访问】
处于安全考虑,Mysql默认是不允许远程访问的,可以使用下面开启远程访问
//赋予任何主机访问数据的权限mysql>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'WITH GRANT OPTION //使修改生效mysql>FLUSH PRIVILEGES
如果依然不能远程访问的话,那就很可能防火墙的原因了,可以在防火墙中开启3306端口或者干脆关掉防火墙。
The above is the detailed content of MySQL - Detailed introduction to installing MySQL5.5 in RPM mode under CentOS. For more information, please follow other related articles on the PHP Chinese website!

本篇文章给大家带来了关于mysql的相关知识,其中主要介绍了关于架构原理的相关内容,MySQL Server架构自顶向下大致可以分网络连接层、服务层、存储引擎层和系统文件层,下面一起来看一下,希望对大家有帮助。

在mysql中,可以利用char()和REPLACE()函数来替换换行符;REPLACE()函数可以用新字符串替换列中的换行符,而换行符可使用“char(13)”来表示,语法为“replace(字段名,char(13),'新字符串') ”。

mysql的msi与zip版本的区别:1、zip包含的安装程序是一种主动安装,而msi包含的是被installer所用的安装文件以提交请求的方式安装;2、zip是一种数据压缩和文档存储的文件格式,msi是微软格式的安装包。

方法:1、利用right函数,语法为“update 表名 set 指定字段 = right(指定字段, length(指定字段)-1)...”;2、利用substring函数,语法为“select substring(指定字段,2)..”。

转换方法:1、利用cast函数,语法“select * from 表名 order by cast(字段名 as SIGNED)”;2、利用“select * from 表名 order by CONVERT(字段名,SIGNED)”语句。

本篇文章给大家带来了关于mysql的相关知识,其中主要介绍了关于MySQL复制技术的相关问题,包括了异步复制、半同步复制等等内容,下面一起来看一下,希望对大家有帮助。

本篇文章给大家带来了关于mysql的相关知识,其中主要介绍了mysql高级篇的一些问题,包括了索引是什么、索引底层实现等等问题,下面一起来看一下,希望对大家有帮助。

在mysql中,可以利用REGEXP运算符判断数据是否是数字类型,语法为“String REGEXP '[^0-9.]'”;该运算符是正则表达式的缩写,若数据字符中含有数字时,返回的结果是true,反之返回的结果是false。


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

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

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

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

Zend Studio 13.0.1
Powerful PHP integrated development environment
