马哥笔记-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


你可能感兴趣的:(linux,mysql)