MySQL Install
1. InstallMySQL using yum
--Check whether mysql has been installed
yum list installed | grep mysql
yum list installed | grep MySQL
--yum -y remove ..... ex:
yum -y remove MySQL-server
yum -y remove MySQL-client-5.5.13-1.rhel5.x86_64
--Install command:
yum search mysql
yum -y install mysql-server.x86_64
/usr/bin/mysql_install_db
--Start mysqld service
service mysqld start
service mysqld
Usage: /etc/init.d/mysqld {start|stop|status|condrestart|restart}
mysqladmin -uroot password [password]
--After installation, mysql directories and files’ distribution
mysql client executable file
/usr/bin/mysql
mysqld service
/usr/libexec/mysqld, /usr/libexec/mysqlmanager
log and database file
/var/lib/mysql
mysql.sock
/var/lib/mysql/mysql.sock
mysql config file
/etc/my.cnf
error message and character files
/usr/share/mysql
2. InstallMySQL using RPM file
--Download mysql-server RPM file
--Download mysql-client RPM file
rpm -ivh MySQL-server-5.5.16-1.linux2.6.x86_64.rpm MySQL-client-5.5.16-1.linux2.6.x86_64.rpm
--Start mysqld service
service mysqld start
service mysqld
Usage: /etc/init.d/mysqld {start|stop|status|condrestart|restart}
mysqladmin -uroot password [password]
-After installation, mysql directories and files’ distribution
mysql client executable file
/usr/bin/mysql
mysqld service
/usr/libexec/mysqld, /usr/libexec/mysqlmanager
log and database file
/var/lib/mysql
mysql.sock
/var/lib/mysql/mysql.sock
mysql config file
/etc/my.cnf
error message and character files
/usr/share/mysql
3. InstallMySQL using source code
cd /home1/mysql
1. Compile and install cmake,
wget http://www.cmake.org/files/v2.8/cmake-2.8.5.tar.gz
tar xvf cmake-2.8.5.tar.gz
cd cmake-2.8.5
./bootstrap
make
make install
2. Compile and install mysql-5.5.15 (Directory: /home1/mysql/mysql-service)
wget http://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.15.tar.gz/from/http://mirror.khlug.org/mysql/
tar xvf mysql-5.5.15.tar.gz
cd mysql-5.5.15
/usr/sbin/groupadd mysql
/usr/sbin/useradd -g mysql mysql
cmake -DCMAKE_INSTALL_PREFIX=/home1/mysql/mysql-service \
-DMYSQL_UNIX_ADDR=/home1/mysql/mysql-service/tmp/mysql.sock \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_EXTRA_CHARSETS:STRING=utf8,gbk,gb2312 \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_MEMORY_STORAGE_ENGINE=1 \
-DWITH_READLINE=1 \
-DENABLED_LOCAL_INFILE=1 \
-DMYSQL_DATADIR=/home1/mysql/mysql-service/data \
-DMYSQL_USER=mysql
make
make install
3. MySQL configuration
chmod +w /home1/mysql/mysql-service
chown -R mysql:mysql /home1/mysql/mysql-service
mkdir -p /home1/mysql/mysql-service/data/
mkdir -p /home1/mysql/mysql-service/log/
cd support-files/
cp my-large.cnf /home1/mysql/mysql-service/my.cnf
cp mysql.server /etc/init.d/mysqld
/home1/mysql/mysql-service/scripts/mysql_install_db \
--defaults-file=/home1/mysql/mysql-service/my.cnf \
--basedir=/home1/mysql/mysql-service \
--datadir=/home1/mysql/mysql-service/data \
--user=mysql
chmod +x /etc/init.d/mysqld
vi /etc/init.d/mysqld(edit this file,find and edit the variables, if there no these variable add them)
basedir=/home1/mysql/mysql-service
datadir=/home1/mysql/mysql-service/data
4. Add them into bootup:
chkconfig --add mysqld
chkconfig --level 345 mysqld on
5. start mysql service:
service mysqld start
6.Set password:
/home1/mysql/mysql-service/bin/mysqladmin password [new-password]
7. Many programs call mysql.sock from /var/lib/mysql/mysql.sock:
mkdir -p /var/lib/mysql
ln -s /var/lib/mysql/mysql.sock /home1/mysql/mysql-service/tmp/mysql.sock
4. InstallMySQL using compressed TAR archive without Installation
1. Download compressed tar archive mysql file
cd /home1/mysql
tar xvf mysql-5.5.16-linux2.6-x86_64.tar.gz
cp -r mysql-5.5.16-linux2.6-x86_64/ mysql
mkdir -p /home1/mysql/mysql/tmp
groupadd mysql
useradd -g mysql mysql
cd /home1/mysql/mysql
ln -s /home1/mysql/mysql/bin/mysql /usr/bin/
chown -R mysql .
chgrp -R mysql .
scripts/mysql_install_db --user=mysql
chown -R root .
chown -R mysql data
cp support-files/my-medium.cnf /etc/my.cnf
vi my.cnf
basedir=/home1/mysql/mysql
datadir=/home1/mysql/mysql/data
socket = /home1/mysql/mysql/tmp/mysql.sock
innodb_data_home_dir = /home1/mysql/mysql/data/
/home1/mysql/mysql/bin/mysqld_safe --user=mysql & --start mysqld service
Error:
110915 18:01:50 [ERROR] Can't start server : Bind on unix socket: Permission denied
110915 18:01:50 [ERROR] Do you already have another mysqld server running on socket: /home1/mysql/mysql/tmp/mysql.sock ?
Solution: chmod 777 /home1/mysql/mysql/tmp/
/home1/mysql/mysql/bin/mysqladmin -uroot -p shutdown -- shut down mysql
Error:
error: 'Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)'
Solution:
-- mysqladmin call mysql.sock from /tmp/mysql.sock default
ln -s /home1/mysql/mysql/tmp/mysql.sock /tmp/mysql.sock
bin/mysqladmin -uroot password [password]
2. Add mysql service into bootup
cp support-files/mysql.server /etc/rc.d/init.d/mysqld
chmod 700 /etc/init.d/mysqld
chkconfig –add mysqld
chkconfig –level 345 mysqld on
相关推荐
centos7.0安装mysql centos7.0安装mysql centos7.0安装mysql
CentOS下MySQL成功安装 MySQL是一种流行的关系数据库管理系统,广泛应用于Web应用程序和企业级应用程序中。在CentOS操作系统中,安装MySQL服务器需要经过一系列的步骤,包括下载、编译、安装、初始化数据库、注册...
MySQL安装后,建议执行`mysql_secure_installation`脚本来增强安全性: ``` /usr/bin/mysql_secure_installation ``` 在这个脚本中,你可以设置root用户的密码、删除匿名用户、禁止root远程登录以及删除测试数据库。...
CentOS 7 安装 MySQL
MySQL安装后,需要进行一些安全配置,如设置root用户的密码,删除匿名用户等,运行`sudo mysql_secure_installation`。 四、连接MySQL 1. 首次安装后,root用户没有密码。可以使用`sudo mysql -u root`进入MySQL...
对于Linux系统,尤其是CentOS 7这样的企业级发行版,MySQL的安装和管理至关重要。本文将详细讲解如何在CentOS 7上离线进行MySQL8的一键自动安装。 首先,离线安装意味着我们需要提前下载MySQL8的安装包,并通过本地...
### CentOS 7.4 安装 MySQL 5.7 的详细步骤及注意事项 #### 一、安装流程 1. **进入指定目录** 首先,打开终端并进入到 `/usr/local/` 目录下: ```bash cd /usr/local/ ``` 2. **创建工具目录** 接着,...
### CentOS安装MySQL 5.7知识点详解 #### 一、环境准备与系统要求 在开始安装MySQL 5.7之前,我们需要确保系统满足以下条件: - **操作系统**:CentOS 7.x或更高版本。 - **硬件配置**:至少1GB内存,推荐2GB以上;...
MySQL安装教程提供了详细的步骤和指导,帮助用户在计算机上成功安装和设置MySQL数据库管理系统。MySQL是一种流行的开源关系型数据库,广泛应用于各种应用程序和网站的后端存储和管理。通过阅读MySQL安装教程,用户...
在本地虚拟机的场合,需要更换yum安装网络地址配置文件CentOS-Base.repo 从阿里云服务器下载一份CentOS-Base.repo文件存到本地
在Linux环境中,特别是CentOS系统上,MySQL 8.0的离线安装是一个常见的需求,尤其是在没有网络连接或者网络环境不稳定的情况下。以下是如何利用提供的压缩包文件进行离线安装MySQL 8.0的详细步骤: 首先,我们看到...
arm架构centos7 下mysql8离线安装包 包含: mysql-community-client-8.0.20-1.el7.aarch64.rpm mysql-community-common-8.0.20-1.el7.aarch64.rpm mysql-community-devel-8.0.20-1.el7.aarch64.rpm mysql-community-...
CentOs7 下 Mysql 5.7 的下载安装和主从同步、双主多从配置详解 CentOs 7 是一个流行的 Linux 操作系统,而 Mysql 5.7 是一个广泛使用的关系型数据库管理系统。本文将详细介绍如何在 CentOs 7 下下载安装 Mysql 5.7...
centos7.9 自动安装mysql8.0.33,附带脚本
centos 6.5下安装配置mysql,以及mysql的安全管理和账户管理
Centos6.7系统安装MySQL5.7总结 本资源总结了在Centos6.7系统中安装MySQL5.7的步骤,包括下载和安装MySQL软件包,创建数据库仓库目录,新建MySQL用户和组,修改目录属有者,配置参数,修改系统配置文件,启动MySQL...
1. **下载MySQL安装文件** 在开始安装前,你需要下载MySQL的服务器、客户端和开发库的安装包。对于这个特定版本,文件包括: - MySQL-server-5.5.31-1.rhel5 - MySQL-devel-5.5.31-1.rhel5 - MySQL-client-...
centos7安装mysql方法
在安装WPS office之前,需要安装依赖包libGLU.so.1()(64bit)和libXss.so.1()(64bit)。这些依赖包可以在pkgs.org网站上下载。下载对应的安装包,然后安装它们。 3. 安装WPS office 将下载的WPS office安装包移到/...
首先,我们有"MySQL-5.6.46-1.el7.x86_64.rpm-bundle.tar"这个压缩包,它是MySQL 5.6针对CentOS 7的RPM软件包集合。RPM(Red Hat Package Manager)是一种用于Linux系统中的软件包管理器,它负责软件的安装、升级和...