Ubuntu 搭建LNMP环境图文教程 安装MySQL数据库
<p>调出命令行界面,键入“cd/usr/local/src”回车,进入到文件夹中,这个文件夹用来保存所需使用的软件安装包。</p>
<p align="center">
<img style="max-width:100%!important;height:auto!important;"title="Ubuntu 搭建LNMP环境图文教程 安装MySQL数据库" alt="Ubuntu 搭建LNMP环境图文教程 安装MySQL数据库" align="" border="0" src="https://zhuji.jb51.net/uploads/img/202305/0d4a2cf5b590e56f2c1aa0df2eb9db88.jpg" width="700"></p>
<p>
接着键入“sudowgethttp://downloads.mysql.com/archives/mysql-5.0/mysql-5.0.45.tar.gz”回车,如果提示输入密码,输入密码后回车,开始下载安装包文件,等待进度条走到头下载完毕。</p>
<p align="center">
<img style="max-width:100%!important;height:auto!important;"title="Ubuntu 搭建LNMP环境图文教程 安装MySQL数据库" alt="Ubuntu 搭建LNMP环境图文教程 安装MySQL数据库" align="" border="0" src="https://zhuji.jb51.net/uploads/img/202305/59bc56ee0dcf49fcc6891638c14e25df.jpg" width="700"></p>
<p>
下载完成后,输入“ll”可以查看到已下载的文件。</p>
<p align="center">
<img style="max-width:100%!important;height:auto!important;"title="Ubuntu 搭建LNMP环境图文教程 安装MySQL数据库" alt="Ubuntu 搭建LNMP环境图文教程 安装MySQL数据库" align="" border="0" src="https://zhuji.jb51.net/uploads/img/202305/efcb3bca7baf59444691543d6afc02a1.jpg" width="700"></p>
<p>
解压安装包文件,键入“sudotarzxvfmysql-5.0.45.tar.gz”回车,开始解压操作直到完成结束。</p>
<p align="center">
<img style="max-width:100%!important;height:auto!important;"title="Ubuntu 搭建LNMP环境图文教程 安装MySQL数据库" alt="Ubuntu 搭建LNMP环境图文教程 安装MySQL数据库" align="" border="0" src="https://zhuji.jb51.net/uploads/img/202305/1e6572a08e3d2bb0c5b3ad8718e9b9f5.jpg" width="700"></p>
<p>
解压结束后,进入安装目录中,键入“cdmysql-5.0.45/”回车。</p>
<p align="center">
<img style="max-width:100%!important;height:auto!important;"title="Ubuntu 搭建LNMP环境图文教程 安装MySQL数据库" alt="Ubuntu 搭建LNMP环境图文教程 安装MySQL数据库" align="" border="0" src="https://zhuji.jb51.net/uploads/img/202305/4873631e05a18de39debd52b2325ff5b.jpg" width="700"></p>
<p>
键入“sudo./configure--prefix=/usr/local/server/mysql/--enable-assembler--with-extra-charsets=complex--enable-thread-safe-client--with-big-tables--with-embedded-server--enable-local-infile--with-plugins=innobase”回车,开始配置安装,直到出现下图说明操作顺利完成。</p>
<p align="center">
<img style="max-width:100%!important;height:auto!important;"title="Ubuntu 搭建LNMP环境图文教程 安装MySQL数据库" alt="Ubuntu 搭建LNMP环境图文教程 安装MySQL数据库" align="" border="0" src="https://zhuji.jb51.net/uploads/img/202305/98fb9258ac6f33ad93d58324c801091d.jpg" width="700"></p>
<p>
我们将环境全部装在“/usr/local/server”下,所以需要先建立目录。输入“sudomkdir/usr/local/server”回车创建目录。</p>
<p align="center">
<img style="max-width:100%!important;height:auto!important;"title="Ubuntu 搭建LNMP环境图文教程 安装MySQL数据库" alt="Ubuntu 搭建LNMP环境图文教程 安装MySQL数据库" align="" border="0" src="https://zhuji.jb51.net/uploads/img/202305/867e5d63f50ecc8fcf93c38c2882916d.jpg" width="700"></p>
<p>
将目录所属者设置成“xinxueqi.com”,执行命令“sudochown-Rxinxueqi.com:xinxueqi.com/usr/local/server”(图中为xinxueqi:xinxueqi并不是xinxueqi.com:xinxueqi.com,这里是用户名:用户组,根据实际情况设置即可)回车。</p>
<p>
接着开始编译MySQL,在mysql-5.0.45目录下键入“sudomake&&makeinstallclean”。</p>
<p align="center">
<img style="max-width:100%!important;height:auto!important;"title="Ubuntu 搭建LNMP环境图文教程 安装MySQL数据库" alt="Ubuntu 搭建LNMP环境图文教程 安装MySQL数据库" align="" border="0" src="https://zhuji.jb51.net/uploads/img/202305/3189a842237e327484855e3ac213cd9c.jpg" width="700"></p>
<p>
编译完成后将会显示下图信息。</p>
<p align="center">
<img style="max-width:100%!important;height:auto!important;"title="Ubuntu 搭建LNMP环境图文教程 安装MySQL数据库" alt="Ubuntu 搭建LNMP环境图文教程 安装MySQL数据库" align="" border="0" src="https://zhuji.jb51.net/uploads/img/202305/2e470136d5f3481539b06d74b676af04.jpg" width="700"></p>
<p>
进入到MySQL目录中,键入“cd/usr/local/server/mysql”回车,再输入“ll”回车,查看目录下的文件列表。</p>
<p align="center">
<img style="max-width:100%!important;height:auto!important;"title="Ubuntu 搭建LNMP环境图文教程 安装MySQL数据库" alt="Ubuntu 搭建LNMP环境图文教程 安装MySQL数据库" align="" border="0" src="https://zhuji.jb51.net/uploads/img/202305/1e396c8226fc7f5bd8f1ce5409bcdd89.jpg" width="700"></p>
<p>
创建配置文件,键入“cp./share/mysql/my-medium.cnf./my.cnf”回车。</p>
<p>
然后安装默认数据库文件,键入“./bin/mysql_install_db”回车。</p>
<p align="center">
<img style="max-width:100%!important;height:auto!important;"title="Ubuntu 搭建LNMP环境图文教程 安装MySQL数据库" alt="Ubuntu 搭建LNMP环境图文教程 安装MySQL数据库" align="" border="0" src="https://zhuji.jb51.net/uploads/img/202305/7d9339d910accd657634f1109c9cc09d.jpg" width="700"></p>
<p>
设置服务启动脚本,执行“sudocp./share/mysql/mysql.server/etc/init.d/mysql”回车。</p>
<p>
再执行“sudochmod+x/etc/init.d/mysql”回车。</p>
<p>
然后使用“/etc/init.d/mysqlstart”及“/etc/init.d/mysqlstop”运行和结束mysql服务。</p>
<p align="center">
<img style="max-width:100%!important;height:auto!important;"title="Ubuntu 搭建LNMP环境图文教程 安装MySQL数据库" alt="Ubuntu 搭建LNMP环境图文教程 安装MySQL数据库" align="" border="0" src="https://zhuji.jb51.net/uploads/img/202305/2bb7142ddc7163e1f9ae769f7f6a0e35.jpg" width="700"></p>
<p>
最后设置数据库root密码,这步要在数据库运行的情况下执行,首先“/etc/init.d/mysqlstart”启动数据库,然后再执行“./bin/mysqladmin-urootpassword123456”(123456是密码,根据实际情况自行设置)回车。</p>
<p align="center">
<img style="max-width:100%!important;height:auto!important;"title="Ubuntu 搭建LNMP环境图文教程 安装MySQL数据库" alt="Ubuntu 搭建LNMP环境图文教程 安装MySQL数据库" align="" src="https://zhuji.jb51.net/uploads/img/202305/5475937555cfe9947c08b4ae615afe0e.jpg"></p>
<p>
MySQL数据库安装到这里结束。</p>
頁:
[1]