Ubuntu系统安装MySQL数据库_什么是数据恢复
日期:2014-07-13 / 人气: / 来源:网络
手动安装mysql
shell> groupadd mysql
shell> useradd -g mysql mysql
shell> gunzip < mysql-VERSION.tar.gz | tar -xvf -
shell> cd mysql-VERSION
shell> ./configure --prefix=/usr/local/mysql
shell> make
shell> make install
shell> cp support-files/my-medium.cnf /etc/my.cnf
shell> cd /usr/local/mysql
shell> bin/mysql_install_db --user=mysql
shell> chown -R root .
shell> chown -R mysql var
shell> chgrp -R mysql .
shell> bin/mysqld_safe --user=mysql &
configure时遇到checking whether the C compiler (gcc ) works... no
configure: error: installation or configuration problem: C compiler cannot create executables.
解决办法
sudo apt-get build-dep fcitx
或者自动安装
安装MySQL
sudo apt-get install mysql-server
配置MySQL
注意,在Ubuntu下MySQL缺省是只允许本地访问的,如果你要其他机器也能够访问的话,那么需要改变/etc/mysql/my.cnf配置文件了!下面我们一步步地来:
默认的MySQL安装之后根用户是没有密码的,所以首先用根用户进入:
$mysql -u root
在这里之所以用-u root是因为我现在是一般用户(kwj),如果不加-u root的话,mysql会以为是kwj在登录。注意,我在这里没有进入根用户模式,因为没必要。一般来说,对mysql中的数据库进行操作,根本没必要进入根用户模式,只有在设置时才有这种可能。
进入mysql之后,最要紧的就是要设置Mysql中的root用户密码了,否则,Mysql服务无安全可言了。
mysql> GRANT ALL PRIVILEGES ON *.* TO root@localhost IDENTIFIED BY "123456";
这样的话,就设置好了MySQL中的root用户密码了,然后就用root用户建立你所需要的数据库。我这里就以test为例:
mysql>CREATE DATABASE test;
mysql>GRANT select,insert,update,delete,create,references,index,alert,Lock tables ON test.* TO test_root@localhost IDENTIFIED BY "123456";
这样就建立了一个test_roots的用户,它对数据库test有着全部权限。以后就用test_root来对test数据库进行管理,而无需要再用root用户了,而该用户的权限也只被限定在test数据库中。
mysql>GRANT ALL PRIVILEGES ON test.* TO test_root@"%" IDENTIFIED BY "123456";
允许test_root用户可以从任意机器上登入MySQL。
MySQL 5.5数据库配置主从同步
导读:【mysqld】expire_logs_day=20;1.主库编辑my.cnf:[mysqld]log-bin=NEW_NAMEserver-id=1 #配一个唯一的ID编号,1至32。#设置要进行或不要进行主从复制的数据库名,同时也要在Slave 上设定
MySQL教程,
作者:管理员
推荐内容 Recommended
- 江苏飞浩信息科技期待您的加入07-20
- 江苏飞浩科技欢迎您07-19
相关内容 Related
- 江苏飞浩信息科技期待您的加入07-20
- 江苏飞浩科技欢迎您07-19