The original text comes from [Tingyun Technology Blog]: http://blog.tingyun.com/web/article/detail/1255
The following is the record of my work, which introduces the installation process and installation screenshot of MySql using the official compiled binary file under the linux system. This installation method is fast and the installation steps are simple!
Friends who need it can install it according to the following steps, you can quickly install MySql, I hope it can help you :)!
1. Download the binary installation package of the linux version of mysql:
Address: http://dev.mysql.com/downloads/mysql/
Here I renamed the installation package to: tingyun-mysql-5.6.22.tar.gz
Note: You can not rename according to your needs
2. Unzip the installation package:
Unzip the installation package in the location to be installed: execute the command as follows:
tar –xPf tingyun-mysql-5.6.22.tar.gz
The screenshot is as follows:
3. Create the mysql installation directory and modify the directory permissions:
The execution command is as follows:
Create the mysql directory: mkdir mysql
Open the mysql directory: cd mysql
Create the data directory: mkdir data
Description: Because the mysql service process mysqld will access the data directory when it runs, create the data directory
Execute the following command in the mysql directory: used to set the owner of the directory to the mysql user:
The screenshot is as follows:
4. Install mysql
Execute the installation command mysql_install_db in the mysql directory:
The screenshot is as follows:
5. Start mysql
Enter the init.d directory and execute the command:
mysqld restart
如果不想重新启动,那可以直接手动启动,执行如下命令:
也可以直接在mysql目录下执行如下命令:
截屏如下:
6、为mysql创建软链接
执行如下命令:
截屏如下:
7、修改mysql配置
执行如下命令进行编辑:
说明:配置使用./mysql的目录(如bin目录里面使用 ./mysql)
(1)在bash_profile 文件的最下面写
执行:wq 命令进行保存退出
(2)执行source命令使系统配置生效:
截屏如下:
8、安全配置向导
Mysql安装完毕后需要按照安全配置想到对mysql进行安全配置:
执行如下命令,对mysql的root用户进行安全配置:
设置新密码选择“Y”,并输入两次新密码(第二次作为确认密码)。
删除匿名用户,选择“Y”
截屏如下:
也可以通过如下方式,为root用户设置密码:
执行如下命令:
截屏如下:
查看mysql安装目录下内容
截屏如下:
9、mysql安装后测试:
(1)查看mysql是否已经启动:
使用如下三种命令中任何一种都可以:
ps -aux | grep mysqld
netstat -lntup|grep 3306
屏幕中打印出mysql相关进程, 会看到如下类似内容:
说明mysql已经启动成功!
(2)要使用mysql,需要如下命令进入mysql:
(3)查看版本:
So far, mysql has been installed and tested successfully, you can use it with confidence :)