Mysql Uninstall and Install

1. Mysql Uninstall

Reference connection:

Shortcut win+r Enter regedit to enter the registry and find HKEY_ LOCAL_ MACHINESYSTEMControlSet001ServicesEventlogApplication\MySQL Folder Delete

Delete HKEY_ LOCAL_ MACHINESYSTEM\ControlSet002ServicesEventlogApplication\MySQL folder.
Delete HKEY_ LOCAL_ Folder for MACHINESYSTEM\CurrentControlSet\ServicesEventlogApplication\MySQL.
Without these two files in the registry, you don't have to delete them
Then open Task Manager and turn off MySQL:

Then delete the installation location of MySQL:
My default path is drive C: C:\Program FilesMySQL\MySQL Server 5.7

Then there's another place: C:\Program Files(x86)MySQL

There is also a hidden file, first click [View]->Check [Hidden Items]

You can see a folder named ProgramData, click open to find MySQL inside, delete it

2. Mysql Green Installation

Reference link:

I tested MySQL 5.7.15 winx64 as an example:

  1. Modify directory structure
Purpose: To data Catalogs are separated to facilitate the storage of data storage space.
     take data put to datafile Similar to putting on other drive operators

Original directory structure:

Now the directory structure:

The INI file in the datafile directory can be deleted here, and the modified my.ini file in the root directory (only my-default.ini and my.ini are described here)

  1. Modify my.ini file
No default profile my.ini You need to my-default.ini Modify to my.ini

my.ini changed the previous pattern:

Configure client Client
Configure the service side mysqld:
If first entry requires skip-grant-tables to be added to my.ini file for secret login

This piece of advice about datadir paths using \\usage\ can cause escape problems such as \s possibly showing spaces

  1. Set environment variables for easy installation

Win +R Input sysdm.cpl Set Environment Variable

  1. Initialize data file
Purpose: mysql5.7 Without data File, manual creation is not recommended here data Folder, probably not mysql Table structure, etc.

Old structure style:

mysqld --initialize-insecure --user=mysql //Initialize data directory

  1. install
mysqld --install mysql3308 --defaults-file="D:\mysql-5.7.15-winx64\my.ini" 

View system services after installation: services.msc Start System Services Manager

View the corresponding attribute information for mysql3308:

Open service: SC start mysql3308 (service name)

Enter mysql and log in confidentially

Set the password for the root user:

5.6 Edition
update mysql.user set password=password("123456") where user="root";
flush privileges; Perform database refresh
5.7 Edition
update mysql.user set authentication_string=password("123456") where user="root";
flush privileges;

Log in after setup to test:

Enter directly after the first entry and discover that you cannot log in confidentially
 Use the password you just set after the second entry to discover that you can connect, indicating that the password was set successfully	
Finally, the skip-grant-tables Comment out

3. Mysql replacement replaces other versions of data: the same version (e.g. 5.7. * and 5.7. *)

Reference link:

  1. data File Copy
    Copy the pre-upgrade data file to the new data
    But do not overwrite the following three folders

    Services will need to be stopped before replacement: sc stop mysql3308
    Copy the original book and ibdata1. This recommendation makes all configuration copies specific to your situation. If there is only a table structure, there may be fewer profiles without table data.

    View the changed datadir file storage location:

4. Problems in Installation

  1. Install mysql Install/Remove of the Service Denied! Error Resolution
    Select Open as Administrator when opening the cmd.exe program.
  2. View mysql installation error information:
    mysqld --console
  3. Command:
sc stop mysql3308 //Out of Service
sc start mysql3308 //Open Service
sc delete mysql3308 //Delete Service
net stop mysql3308 //Out of Service
net delete mysql3308 //Delete Service
net start mysql3308 //Open Service
 Sign out mysql data base   quit Command to exit or exit
  1. Service Start Failure
    Reason: The data directory may not be found (initializing the data directory solves the problem), my.ini configuration file is correct, and environment variables are set correctly

5. Mysql Encoding Format

  1. Encoding format:
ALTER DATABASE `data base` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci 
ALTER TABLE `Data sheet` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci   (Note: This sentence sets the default character set and all character columns of the table ( CHAR,VARCHAR,TEXT)Change to a new character set:
Modify database characters: alter database child default character set utf8 collate utf8_general_ci; 
Modify table characters: Alter table thing  default character set utf8 collate utf8_general_ci
 Modify column encoding: alter table thing(Table Name) modify column Column Name varchar(512) character set utf8 collate  utf8_general_ci

Tags: Database MySQL

Posted on Sat, 27 Nov 2021 13:32:31 -0500 by krupapatel