ubuntu离线安装mysql

来源:互联网 发布:手机点击软件快速 编辑:程序博客网 时间:2024/05/19 09:39

测试环境:ubuntu12.04-amd64

Mysql离线包:mysql-5.5.25-linux2.6-x86_64.tar.gz

官方安装步骤如下:



注意事项:

如果执行scripts/mysql_install_db –user=mysql时出现如下错误:

InstallingMySQL system tables…./bin/mysqld: error while loading shared libraries:

libaio.so.1:cannot open shared object file: No such file or directory

这说明还要安装一个libaio的依赖库,执行如下命令:


或者下载libaio1_0.3.109-2ubuntu1_amd64.deb包,然后执行命令:


其他设置:

1、  为root设置密码(在/usr/local/mysql目录下)执行以下命令:

1#./bin/mysqladmin -u root password 'password'

2、  查看mysql版本:

1#./bin/mysqladmin-u root -p version

3、  停止mysql:

1#./bin/mysqladmin-uroot -ppassword shutdown 注意,u,p后没有空格

4、  本机登陆mysql:

1#./bin/mysql–u root –p

5、  设置允许root远程登陆mysql,本机登陆mysql后,

(1)执行后续命令进入mysql数据库:

1mysql>use mysql;

(2)然后执行(设置允许任意主机可以访问

1mysql> grant all privileges on *.* to root@"%"identified by "password"with grant option;

(3)如果指定机器访问:

1mysql> grant all privileges on *.* to root@"192.168.16.105"identified by "password" with grantoption; flush privileges;

(4) 进mysql库查看host为%的数据是否添加:

1mysql>use mysql; mysql>select* from user;

6、如果想在任何地方都能直接使用mysql命令,需要设置环境变量:

(1)在终端输入命令

1# vi /etc/environment

(2)在PATH=“…”最后添加mysql可执行文件所在路径(在这里是:/usr/local/mysql/bin)

(3)保存退出,然后在终端执行命令:

1#source /etc/environment

6、远程登陆mysql:

查看源代码
打印帮助
1mysql –h IP –uroot –p

0 0
原创粉丝点击