mysql 安装及设置

Posted 67373cyf

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了mysql 安装及设置相关的知识,希望对你有一定的参考价值。

mysql下载安装记录

设备情况:win10,之前没有进行过mysql安装。
一下载:直接官网下载,https://dev.mysql.com/downloads/file/?id=490026 下载的是解压版的。版本8.0.18 压缩包270M左右。下载完之后解压。

二安装 : 参照 https://www.runoob.com/mysql/mysql-install.html 注意:cmd要用 【管理员权限】启动->在这里C:WindowsSystem32cmd.exe 然后运行到mysqld -install的时候
下一步net start mysql 可能会出错:

D:mysql-8.0.18-winx64in>net start mysql
发生系统错误 193。

*** 不是有效的 Win32 应用程序。

这时候看这篇博客,原理好像是第一次默认安装在c盘,需要手动删除,然后remove一下,再次安装,就到你的指定的目录了。然后再net启动,就成功了

https://blog.csdn.net/qq_35164169/article/details/77863600

 

下面是我的安装过程;
C:Windowssystem32>d:

D:mysql-8.0.18-winx64in>mysqld install
Service successfully installed.

D:mysql-8.0.18-winx64in>net start mysql
发生系统错误 193。

*** 不是有效的 Win32 应用程序。


D:mysql-8.0.18-winx64in>mysqld install
The service already exists!
The current server installed: C:Windowssystem32mysqld MySQL

D:mysql-8.0.18-winx64in>c:

C:WindowsSystem32>d:

D:mysql-8.0.18-winx64in>mysqld remove
Service successfully removed.

D:mysql-8.0.18-winx64in>mysqld -install
Service successfully installed.

D:mysql-8.0.18-winx64in>mysqld -install
The service already exists!
The current server installed: D:mysql-8.0.18-winx64inmysqld MySQL

D:mysql-8.0.18-winx64in>net start mysql
MySQL 服务正在启动 .
MySQL 服务已经启动成功。


D:mysql-8.0.18-winx64in>mysql -u root -p
Enter password: ************
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 8
Server version: 8.0.18

Copyright (c) 2000, 2019, 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>

到这里就安装完成了,且完成了登录。

 

 

 


cd D:mysql-8.0.18-winx64in

Xkm?o-<aR4d=

D:mysql-8.0.18-winx64in>
D:mysql-8.0.18-winx64in>mysqld --initialize --console
2019-10-28T00:52:20.344670Z 0 [System] [MY-013169] [Server] D:mysql-8.0.18-winx64inmysqld.exe (mysqld 8.0.18) initializing of server in progress as process 12956
2019-10-28T00:52:21.724707Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: Xkm?o-<aR4d=


D:mysql-8.0.18-winx64in>mysqld --initialize --console
2019-10-28T00:58:45.711083Z 0 [System] [MY-013169] [Server] D:mysql-8.0.18-winx64inmysqld.exe (mysqld 8.0.18) initializing of server in progress as process 1104
2019-10-28T00:58:45.712542Z 0 [ERROR] [MY-010457] [Server] --initialize specified but the data directory has files in it. Aborting.
2019-10-28T00:58:45.712555Z 0 [ERROR] [MY-013236] [Server] The designated data directory D:mysql-8.0.18-winx64data is unusable. You can remove all files that the server added to it.
2019-10-28T00:58:45.718481Z 0 [ERROR] [MY-010119] [Server] Aborting
2019-10-28T00:58:45.719322Z 0 [System] [MY-010910] [Server] D:mysql-8.0.18-winx64inmysqld.exe: Shutdown complete (mysqld 8.0.18) MySQL Community Server - GPL.

# datadir=D:mysql-8.0.18-winx64

 

//这个可以用 先创建用户,然后分配权限;%可以远程连接 修改后可以在workbench上登录
CREATE USER ‘zhangsan‘@‘%‘ IDENTIFIED BY ‘123456‘;
GRANT ALL PRIVILEGES ON lskj.* TO ‘zhangsan‘@‘%‘ WITH GRANT OPTION;
FLUSH PRIVILEGES;


//修改远程登录方法 可以在vs上使用。
ALTER USER ‘zhangsan‘@‘%‘ IDENTIFIED BY ‘123456‘ PASSWORD EXPIRE NEVER;
ALTER USER ‘zhangsan‘@‘%‘ IDENTIFIED WITH mysql_native_password BY ‘123456‘;
FLUSH PRIVILEGES;

以上是关于mysql 安装及设置的主要内容,如果未能解决你的问题,请参考以下文章

Ubuntu之Mysql安装及基本设置

Ubuntu安装mysql及设置远程访问方法

ubuntu mysql安装及需要其他主机连服务器mysql时的设置(error:10061)

mysql免安装版出现的问题及应对

mysql 最小配置 及 安装

mysql安装及常见问题