my.ini
####################配置文件开始################### # For advice on how to change settings please see # http://dev.mysql.com/doc/refman/5.7/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. [client] default-character-set=utf8 [mysqld] port=3306 basedir ="D:IDEmysql-5.7.20-winx64" datadir ="D:IDEmysql-5.7.20-winx64data" tmpdir ="D:IDEmysql-5.7.20-winx64data" socket ="D:IDEmysql-5.7.20-winx64datamysql.sock" log-error="D:IDEmysql-5.7.20-winx64datamysql_error.log" #server_id = 2 #skip-locking max_connections=100 table_open_cache=256 query_cache_size=1M tmp_table_size=32M thread_cache_size=8 innodb_data_home_dir="D:IDEmysql-5.7.20-winx64data" innodb_flush_log_at_trx_commit =1 innodb_log_buffer_size=128M innodb_buffer_pool_size=128M innodb_log_file_size=10M innodb_thread_concurrency=16 innodb-autoextend-increment=1000 join_buffer_size = 128M sort_buffer_size = 32M read_rnd_buffer_size = 32M max_allowed_packet = 32M explicit_defaults_for_timestamp=true sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION" #sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES ####################配置文件结束###################
[MASTER主机]
服务注册 mysqld install MySQL --defaults-file="D:IDEmysql-5.7.20-winx64my.ini"
修改注册表 HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesMySQL
初始化 mysqld --initialize
启动 net start mysql
==================================================================================
由于MYSQL5.6开始ROOT就是随机密码,所以需要修改密码
net stop mysql
cd "C:Program Files (x86)MySQLMySQL 5.7in"
start mysqld --skip-grant-tables
mysql -ANe"update mysql.user set authentication_string=PASSWORD('a') where user='root'"
mysqladmin shutdown
net start mysql
mysql -uroot -p
Enter password: (enter the password 'mynewpassword' and hit <Enter>)
==================================================================================
卸载:
移除服务 mysqld remove
sc delete MySQL
reg delete "HKEY_LOCAL_MACHINESYSTEMControlSet001ServicesEventlogApplicationMySQL" /f
reg delete "HKEY_LOCAL_MACHINESYSTEMControlSet002ServicesEventlogApplicationMySQL" /f
reg delete "HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesEventlogApplicationMySQL" /f
[SLAVE从机]
mysqld install MySQL-SLAVE --defaults-file="D:IDEmysql-5.7.20-winx64-slavemy.ini"
卸载:
移除服务 mysqld remove
sc delete MySQL-SLAVE
reg delete "HKEY_LOCAL_MACHINESYSTEMControlSet001ServicesEventlogApplicationMySQL-SLAVE" /f
reg delete "HKEY_LOCAL_MACHINESYSTEMControlSet002ServicesEventlogApplicationMySQL-SLAVE" /f
reg delete "HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesEventlogApplicationMySQL-SLAVE" /f
=============================================================================================
在公司的win7笔记本上,遇到过一直在启动中,卸载之后服务也一直都在删不干净,新装服务又说服务已存在,附解决办法:
如何彻底的卸载和删除Windows service
最近遇到很头疼的问题,安装到服务器的Windows Service卸载的时候出错了,结果在服务列表中就一直驻留,并且系统进程一直在运行,怎么都杀不掉。
最后终于找到办法了:
1.常规做法,批处理命令卸载
Net Stop ServiceName
sc delete ServiceName
pause
2.如果还是没办法,那就继续尝试
a.找到系统注册表,删掉服务的注册表信息,通常路径在:HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServices 找到你的Service服务的名字,然后把整个文件夹删掉
b.如果还是在继续运行,service列表中还显示的话,用管理员权限打开cmd 命令 sc delete serviceName,如果提示 “the specified service is marked as deletion”。
导致windows service不能部署,也不能被删除,使用 SC 命令也不奏效。确实冒了一把冷汗。经过10几分钟的折腾,终于弄明白了:原来是windows service database缓存的原因,reboot server可以完美解决问题。但实际上我们可以尝试:
1. 关闭所有windows service控制面板。
2. 查找windows service的PID:SC queryex service_name
3. 杀掉进程:taskkill /PID service_pid /f
这样就再也不用担心windows service部署了。
至此就可以完全卸载掉了。
总结一下自己在工作中的经验。
===========================================================================================
创建用户和授权
mysql> mysql -uroot -pa
mysql> create database demodb;
mysql> create user 'a'@'localhost' identified by 'a';
mysql> grant all on demodb.* to 'a'@'localhost';