linux 笔记: mysql : install and primary usage

install -- 

sudo apt-get install mysql-server

sudo apt-get install mysql-client

 

enter my sql query tool:

mysql --user=root --password=xxx

 

commands:

 -- show all databases

 show databases;

 

-- change database

USE mysql;

 

-- check how many users are there in current database

select host,user,password from user; 

-- add a user

1. in shell

mysqladmin -u root password 'new-password' 

2. with query to update password

mysql> USE mysql;
mysql> UPDATE user SET Password=PASSWORD('new-password') WHERE user='root';
mysql> FLUSH PRIVILEGES;

     

 

 

posted on 2012-03-25 16:38  learner  阅读(219)  评论(0编辑  收藏  举报

导航