系统版本:Ubuntu 12.04 LTS 64位
mysql版本:mysql-5.6.14-linux-glibc2.5-x86_64.tar.gz
1、将下载的mysql-5.6.14-linux-glibc2.5-x86_64.tar.gz解压到/usr/local/mysql-5.6.14/文件夹下。
sudo tar zcvf mysql-5.6.14-linux-glibc2.5-x86_64.tar.gz /usr/local/mysql-5.6.14/
解压后的文件目录:
2、创建用户和组。
创建组:
sudo groupadd mysql
创建用户:
sudo useradd -r -g mysql mysql
在此创建的mysql用户只是用来控制文件的权限,可以使用“-r”参数,让该用户不需要登录。
3、改变/usr/local/mysql-5.6.14/文件夹的所有者为mysql用户。
sudo chown -R mysql:mysql /usr/local/mysql-5.6.14/
4、 安装共享库libaio1。
sudo apt-get install libaio1
5、 使用mysql_install_db初始化授权表。
sudo scripts/mysql_install_db --user=mysql
6、配置mysql服务。
打开/etc/init.d/文件夹:
cd /etc/init.d
创建mysql服务的链接:
sudo ln -s /usr/local/mysql-5.6.14/support-files/mysql.server
打开/usr/local/文件夹:
cd /usr/local
创建mysql的链接:
sudo ln -s /usr/local/mysql-5.6.14 mysql
把mysql服务的所有权赋予mysql用户:
sudo chown -R mysql:mysql mysql
启动mysql:
sudo /etc/init.d/mysql.server start
7、查看进程,看mysql服务是否启动。
ps -aux | grep mysql
8、查看mysql版本;
bin/mysqladmin version
mysql安装成功。
下面开始配置mysql:
1、为mysql的root用户创建密码。
首先。进入mysql的安装目录(mysql默认安装到/usr/local/mysql文件夹下):
cd /usr/local/mysql
其次,输入以下代码,设置新密码:
./bin/mysqladmin -u root password '123456'
2、安全配置,删除Test数据库和匿名操作等。
输入以下代码:
sudo bin/mysql_secure_installation
接下来,只要按照提示进行操作就可以了:
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MySQL to secure it, we'll need the current
password for the root user. If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none):
OK, successfully used password, moving on...
Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.
You already have a root password set, so you can safely answer 'n'.
Change the root password? [Y/n] n
... skipping.
By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] y
... Success!
Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] y
... Success!
By default, MySQL comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] y
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] y
... Success!
All done! If you've completed all of the above steps, your MySQL
installation should now be secure.
Thanks for using MySQL!
Cleaning up...
3、配置开机启动。
sudo update-rc.d mysql.server defaults
4、环境变量配置。
由于使用二进制安装mysql,系统对在终端下直接输入mysql等命令不能识别,每次执行mysql命令都要输入绝对路径或者必须在安装目录下执行,比较麻烦,因此,可以采用配置环境变量的方式来解决。
编辑/etc/profile文件:
将下面的代码加入/etc/profile文件中。
export PATH="$PATH:/usr/local/mysql/bin"
保存,重启电脑。mysql命令就可以在终端下直接使用了。
环境变量配置完成。
- 大小: 26.6 KB
- 大小: 57.4 KB
- 大小: 57.6 KB
- 大小: 43.6 KB
分享到:
相关推荐
ubuntu12.04安装mysql---黑佳伦.pdf
Ubuntu 12.04下如何安装MySQL ,我按照这文档,已经成功在ubuntu 12.04安装成功mysql!
ubuntu 12.04 安装mysql---黑佳伦.docx
Ubuntu12.04 nginx python uwsgi Django安装步骤
ubuntu12.04安装及配置过程详解
Ubuntu Server 12.04安装图解,附件中为安装过程中全部截图,可按照图中所选择部分安装
自己在安装和使用mysql过程中总结的各种问题,希望帮到你,还不会的可以联系我 decoderworld@126.com
Ubuntu12.04下的JDK安装,首先到官网上下载jdk-7u51-linux-x64.tar.gz。
乌班图系统Ubuntu 12.04安装教程.docx
ubuntu12.04安装与桌面配置过程详解
ubuntu12.04安装QQ2015的方法
win7下U盘安装ubuntu12.04双系统教程 亲测实现
Ubuntu12.04下Ns2.35安装步骤,完美安装,可实现相关协议的开发和研究。
在Ubuntu12.04环境下安装JDK7
ubuntu12.04安装snort文档
用 VMware 安装 Ubuntu 12.04详细过程图解
Ubuntu 12.04 菜鸟完全使用教程让你用最快的速度熟悉使用Ubuntu 12.04!
在ubuntu 12.04 上完成的git服务器搭建步骤。
zabbix2.03在ubuntu12.04上的安装(最新)
libc6 for ubuntu 12.04 所有依赖的库都打包 .