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;