mysql 安装笔记

       mysql  安装笔记

//1.初始化mysql
mysqld --initialize-insecure --user=mysql

//2.安装mysql服务
mysqld.exe --install mysql --defaults-file=“C:\Program Files\Java\mysql\my.ini”

//3.启动mysql服务
net start mysql

//4.登录mysql
mysql -u root -p

//5.若是登录失败,可以移除mysql服务,重新安装执行1234。
mysqld --remove mysql

//6.mysql设置密码命令
mysqladmin -u root password “123456”

//7.在安装mysql8的时候如果选择了密码加密,之后用客户端连接比如navicate,会提示客户端连接caching-sha2-password,是由于客户端不支持这种插件,可以通过如下方式进行修改:

 #修改加密规则  
ALTER USER 'root'@'localhost' IDENTIFIED BY 'password' PASSWORD EXPIRE NEVER; 
#更新密码(mysql_native_password模式)    
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '{NewPassword}';

my.ini 文件模板

For advice on how to change settings please see

http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html

*** DO NOT EDIT THIS FILE. It’s a template which will be copied to the

*** default location during install, and will be replaced if you

*** upgrade to a newer version of MySQL.

[mysqld]

Remove leading

and set to the amount of RAM for the most important data

cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.

innodb_buffer_pool_size = 128M# Remove leading

to turn on a very important data integrity option: logging

changes to the binary log between backups.

log_bin# These are commonly set, remove the

and set as required.

basedir = …

datadir = …

port = …

server_id = …

basedir = C:\Program Files\Java\mysql
datadir = C:\Program Files\Java\mysql\data
socket= C:\Program Files\Java\mysql\mysql.sock
log-error= C:\Program Files\Java\mysql\data\mysql_error.log
port = 3306
server_id = 1

Remove leading

to set options mainly useful for reporting servers.

The server defaults are faster for transactions and fast SELECTs.

Adjust sizes as needed, experiment to find the optimal values.

join_buffer_size = 128M# sort_buffer_size = 2M

read_rnd_buffer_size = 2M

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

你可能感兴趣的:(mysql 安装笔记)