Mysql学习
1.登录mysql,进入mysql bin 目录:
mysql -u root -p
回车后提示输入密码,刚创建完数据库后,root 密码为空,直接回车登录;也可以再登录时指定连接的数据库:
mysql -u root -p dbname
-p在这里是为了安全,因为这样的话数据库会在回车后使用密文的方式提示你输入密码,如果想略过密文可以在-p后面不加任何空格输入密码,如:
1: mysql -u root -ppassword
2.修改root 用户密码:
方法1:
mysql> set password for 'root'@'localhost'=password('sywu');
方法2,直接更新user 表:
mysql> use mysqlDatabase changedmysql> update user set password=password('sywu') where user='root';
Query OK, 2 rows affected (0.00 sec)Rows matched: 3 Changed: 2 Warnings: 0
3.查看数据库:
mysql> show databases;+--------------------+| Database |+--------------------+| information_schema || cdcol || mysql || performance_schema || phpmyadmin || test || webauth || wordpress |+--------------------+8 rows in set (0.00 sec)
4.连接某个数据库:
mysql> use mysql;Database changed
5.启动mysql的服务:mysql_home\bin\mysqld.exe
Hope is personal,hope is something that no one can give to you,you have to choose to believe in hope,you have to make it yourself..