马哥数据库mysql笔记_马哥笔记-mysql

反关系模型:NoSQL

MongoDB

Redis

HBase

MySQL版本:

Community Edition

Enterprise Edition

软件包格式: mysql, mysql-server, php53-mysql

centos仓库包

mysql官方特定rpm包(不建议)

mysql官方通用rpm包(不建议)

mysql官方源码包

安装:

yum install mysql-server

安装完毕:

mysql   --client

mysqld  --server

tcp/3306

/var/lib/mysql

初始化:建立元数据库

service mysqld start  第一次启动会自动初始化元数据库

----------------------------------------------------------------------------------------------

[root@localhost html]# service mysqld start

Initializing MySQL database:  Installing MySQL system tables...

OK

Filling help tables...

OK

To start mysqld at boot time you have to copy

support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !

To do so, start the server, then issue the following commands:

/usr/bin/mysqladmin -u root password 'new-password'

/usr/bin/mysqladmin -u root -h localhost.localdomain password 'new-password'

Alternatively you can run:

/usr/bin/mysql_secure_installation

which will also give you the option of removing the test

databases and anonymous user created by default.  This is

strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:

cd /usr ; /usr/bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl

cd mysql-test ; perl mysql-test-run.pl

Please report any problems with the /usr/bin/mysqlbug script!

The latest information about MySQL is available on the web at

http://www.mysql.com

Support MySQL by buying support/licenses at http://shop.mysql.com

----------------------------------------------------------------------------------------------

mysql

-u Username

-p password

-h MySQL_SERVER

独特的mysql用户: Username@Host, 二者构成一个完整的用户,HOST不同,可能不能登录

例如: select user, host, password from mysql.user;

mysql连接数据库后,/var/lib/mysql/ 目录下有个mysql.lock文件

每创建一个DB,在/var/lib/mysql/ 就多一个同名目录

mysql客户端:

交互式命令

客户端命令: q

服务器端命令: 必须使用语句结束符(;)

批处理命令(执行myql脚本)

设定用户密码:

方法一:

select user, host, password from mysql.user;

SET PASSWORD FOR 'username'@'host'=PASSWORD('password');

set password for 'root'@'localhost'=PASSWORD('123');

FLUSH PRIVILEGS;

方法二:

update user set Password=PASSWORD('password') where user='User';

方法三:shell里面操作

mysqladmin -uUsernmame -hHOST -p password 'password'

mysqladmin -uroot -hlocalhost -p password '456'

授予权限:

GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.%.%' IDENTIFIED BY 'pass123';

图形化客户端:

1,phpMyAdmin  phpMyAdmin-3.4.3.2-all

2, WorkBench

3, Mysql front

4, Navicat for Mysql

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值