Home > Database > Mysql Tutorial > body text

Linux下MySQL安装详解_MySQL

PHP中文网
Release: 2016-05-27 13:45:07
Original
1285 people have browsed it

安装前期准备

1.需要mysql安装包,并解压,解压命令 tar -zxvf +压缩包名
这里写图片描述
2.将其复制到需要安装的位置
这里写图片描述
我打算安装到/usr/local/mysql目录下
3.创建mysql用户与mysql组,用于管理mysql
这里写图片描述

开始安装

1.配置安装等信息

./configure --prefix=/usr/local/mysql/   
--with-charset=utf8 --with-extra-charsets=all 
--with-unix-socket-path=/usr/local/mysql/var/mysql.sock 
--with-named-curses-libs=/lib/libncursesw.so.5
Copy after login

查看安装配置参数方式./configure &ndash;help<br><img alt="这里写图片描述" src="http://img.bitscn.com/upimg/allimg/c160504/14623310U1GZ-11c06.jpg" title="\"><br>配置常用参数说明:

参数 说明
&ndash;prefix=/usr/local/mysql/ 安装路径
&ndash;with-charset=utf8 mysql默认字符集
with-extra-charsets=all 支持多语言
&ndash;with-unix-socket-path=/usr/local/mysql/var/mysql.sock 这个是指定mysql服务器启动后,联机套接字文件所处的位置和文件名,也就是说,如果CentOS mysql服务器成功启动后,就能在//usr/local/mysql/mysql/var目录中看到mysql.sock文件。如果看不到,肯定是CentOS mysql启动不了
&ndash;with-named-curses-libs=/lib/libncursesw.so.5 为了让mysql能够识别出路径

mysql允许的字符集有<br><img alt="这里写图片描述" src="http://img.bitscn.com/upimg/allimg/c160504/14623310U50-124E9.jpg" title="\"><br>配置完成界面如下<br><img alt="这里写图片描述" src="http://img.bitscn.com/upimg/allimg/c160504/14623310U6250-13c29.jpg" title="\"><br>2.执行make命令<br>如果此时提示如下错误<br>No curses/termcap library found<br><img alt="这里写图片描述" src="http://img.bitscn.com/upimg/allimg/c160504/14623310UY060-141331.jpg" title="\"><br>解决办法:<br>解决方式(CentOS)<br>yum list"grep ncurses<br>yum -y install ncurses-devel<br>最后界面如下<br><img alt="这里写图片描述" src="http://img.bitscn.com/upimg/allimg/c160504/14623310V1250-15SJ.jpg" title="\"><br>3.执行make install 命令

4.创造mysql授权表<br>做了这些工作以后,还得创造CentOS mysql授权表,否则数据库也是启动不了。mysql安装的命令都安装到了/usr/local/mysql/bin这个目录中。<br>运行mysql_install_db命令过后,我们查看/usr/local/mysql就会发现,有个var的目录。这个目录,就是用来装所有数据库的位置,比如我们创建了xxpt的数据库后,就在在/usr/local/mysql/var目录中有xxpt的目录。<br><img alt="这里写图片描述" src="http://img.bitscn.com/upimg/allimg/c160504/14623310V3Z60-164517.jpg" title="\">

启动MySQL

启动mysql<br>mysql.server start<br><img alt="这里写图片描述" src="http://img.bitscn.com/upimg/allimg/c160504/14623310V5N10-1M336.jpg" title=""><br>关闭mysql<br>mysql.server stop<br>mysql.server文件位于/usr/local/mysql/share/mysql目录中。

以上就是Linux下MySQL安装详解_MySQL的内容,更多相关内容请关注PHP中文网(m.sbmmt.com)!


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!