Set a root password if there is on root password.
# mysqladmin -u root password newpassword
Update a root password.
# mysqladmin -u root -p oldpassword newpassword
Login to remote host.
# /bin/mysql -h hostname -u root -p
Login locally.
# /bin/mysql -u root -p
Create a database on the sql server.
mysql> create database [databasename];
List all databases on the sql server.
mysql> show databases;
Allow the user “john” to connect to the server from localhost using the password “passwd”.
# mysql -u root -p
mysql> grant usage on database.* to john@localhost identified by ‘passwd’;
mysql> flush privileges;
Change a users password from unix shell.
# /bin/mysqladmin -u username -p password ‘new-password’
Switch to a database.
mysql> use [db name];
To see all the tables in the db.
mysql> show tables;
To see database’s field formats.
mysql> describe [table name];
To delete a db.
mysql> drop database [database name];
To delete a table.
mysql> drop table [table name];
Recover mysql root password.
# /etc/init.d/mysql stop
# mysqld_safe –skip-grant-tables &
# mysql -u root
mysql> use mysql;
mysql> update user set password=PASSWORD(“newrootpassword”) where User=’root’;
mysql> flush privileges;
mysql> quit
# /etc/init.d/mysql stop
# /etc/init.d/mysql start
Tags
antivirus bash script comm configd coovaap wrt54g no space left dd-wrt hard reset dd-wrt wr741nd hard reset diff firewall free google seo i.t. support iptables IT Support keywords meta tag linux linux mysql linux script mac mac freeze mac freeze when awaking from hibernate mode meta tag multi boot linux windows netbios parallels desktop freeze pc repair pc support real time traffic remote backup rsync rsync space search engine security seo tcpdump tips useful linux command virtualization wireless ap wrt54g recovery 上門電腦維修 中小企 電腦維修