[toc]
mysql基础 mysql基本操作
Mysql 关系型数据库,表跟表之间可以建立关系
库-->表:列(字段 faield)
行(记录 record)
1.连接mysql
$ mysql -u root -p
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 32
Server version: 5.6.40 MySQL Community Server (GPL)
Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
2.设置root密码
方法一 命令行设置
mysqladmin -uroot password '密码'
方法二 进入mysql设置
set password = password('密码');
3.mysql初始安全设置
$ mysql_secure_installation
Enter current password for root (enter for none): # 输入root密码
Change the root password? [Y/n] # 是否改变root密码
Remove anonymous users? [Y/n] # 是否移除匿名用户
Disallow root login remotely? [Y/n] # 是否允许root远程登陆
Remove test database and access to it? [Y/n] # 是否移除test库并且不能访问
Reload privilege tables now? [Y/n] # 是否重新加载权限表
Enter current password for root (enter for none): # 输入root密码