10MySQL数据库安装
Posted 冰原2010
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了10MySQL数据库安装相关的知识,希望对你有一定的参考价值。
(1)二进制安装mysql 5.7
1)下载MySQL包文件并解压:
[root@localhost ~]# tar xf mysql-5.7.33-linux-glibc2.12-x86_64.tar.gz -C /usr/local
[root@localhost ~]# cd /usr/local/
[root@localhost local]# ln -sv mysql-5.7.33-linux-glibc2.12-x86_64 mysql
2)添加mysql用户:
[root@localhost ~]# groupadd mysql && useradd -r -g mysql mysql
3)数据库初始化:
[root@localhost local]# chown -R mysql:mysql /usr/local/mysql
[root@localhost local]# /usr/local/mysql/bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
4)编写数据库配置文件:vim /etc/my.cnf
[mysqld]
datadir=/usr/local/mysql/data
basedir=/usr/local/mysql
socket=/var/lib/mysql/mysql.sock
port = 3306
user=mysql
# Disablingsymbolic-links is recommended to prevent assorted security risks
symbolic-links=0
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
[client]
port=3306
socket=/var/lib/mysql/mysql.sock
5)准备服务文件:
[root@localhost local]# cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
[root@localhost local]# chmod 755 /etc/init.d/mysqld
[root@localhost local]# chkconfig --add mysqld
[root@localhost local]# chkconfig mysqld on
[root@localhost local]# chkconfig --list
6)数据库启动:
[root@localhost local]# service mysqld start
7)添加环境变量:
[root@localhost local]# vim /etc/profile
export PATH=$PATH:/usr/local/mysql/bin
[root@localhost local]# source /etc/profile
8)数据库安全配置:
[root@localhost local]# /usr/local/mysql/bin/mysql_secure_installation
以上是关于10MySQL数据库安装的主要内容,如果未能解决你的问题,请参考以下文章
续:纠正:ubuntu7.04可以安装,而且完美的安装 ! for《Oracle-10.2.0.1,打补丁10.2.0.5:在 debian 版本4不含4以上,及 ubuntu 7.04不含(代码片段