mysql数据库的下载、安装登录和启动

http://www.runoob.com/mysql/mysql-install.html

1、接下来我们来启动下 MySQL 数据库:

以管理员身份打开 cmd 命令行工具,切换目录:

cd E:\mysql-8.0.11-winx64

输入以下安装命令:

mysqld install

启动输入以下命令即可:

net start mysql

注意: 在 5.7 需要初始化 data 目录:

cd E:\mysql-8.0.11-winx64
mysqld --initialize-insecure 

初始化后再运行 net start mysql 即可启动 mysql。

2、连接MySQL服务器

服务启动成功之后,就可以连接/登录MySQL服务器了,打开命令提交符界面输入mysql -u root -pmysql -h localhost -u root -p(第一次登录没有密码,直接按回车过),登录成功,但是登录成功后,不能执行任何操作,MySQL服务器要求您必须设置密码再执行其它操作。

假设我们登录成功后,要查看当前目录下所数据名称(执行查询:show databases),但它提示要先设置密码。完整的过程如下所示 -

D:\software\mysql-5.7.18-winx64\bin>mysql -hlocalhost -uroot -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.7.9

Copyright (c) 2000, 2017, 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> show databases;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';
Query OK, 0 rows affected (0.08 sec)

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
+--------------------+
6 rows in set (0.11 sec)

mysql>

Shell

有关解压包安装MySQl服务器就这样完成了~,如果想要使用在线安装的方式来安装MySQL,请参考: http://dev.mysql.com/doc/refman/5.7/en/mysql-installer.html

猜你喜欢

转载自blog.csdn.net/zhane8204/article/details/81115192