MySQL's free installation and configuration change password

mysql-5.6.17-win32 installation-free version configuration details Step-by-
step reading
tools / raw materials
windows 2003 R2 mysql-5.6.17-win32.zip
method / step
1 to
download mysql-5.6.17-win32; official website download address Baidu
2
unzip to self Define the directory, what I am demonstrating here is D:\wamp\mysql\
3
Copy my-default.ini in the root directory, rename it to my.ini, replace my.ini with the following content #The
following is the copied content, this line can not be copied
[client]
port=3306
default-character-set=utf8 #The
character type of the client is the same as that of the server. It is recommended to use utf8
[mysqld]
port=3306
character_set_server=utf8 #The
character type of the server is recommended to be utf8
basedir=D:\wamp \mysql #Unzip
the root directory
datadir=D:\wamp\mysql\ data #Unzip
the root directory\data
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
[WinMySQLAdmin]
D:\wamp\mysql\bin\mysqld.exe #Unzip 
the root directory\bin\mysqld.exe #The
above is the copied content, this line can not be copied
4
Environment variable configuration
My computer-properties-advanced-environment variables-new
variable MYSQL_HOME Value D:\wamp\mysql
Find the variable path Edit, add ;%MYSQL_HOME%\bin
5
, enter cmd in the run, or find C:\Windows\System32\cmd.exe, enter the bin subdirectory of the mysql decompression directory,
C:\Documents and Settings\Administrator>cd\
C:\>d:
D:\>cd wamp
D:\wamp>cd mysql
D:\wamp\mysql>cd bin
D:\wamp\mysql\bin>
D: \wamp\mysql\bin>mysqld -install 
prompts: Service successfully installed. And the installation is successful.
(CMD command: CD\ return to the root directory
           D: enter D drive 
           cd wamp enter the WAMP folder)
6
Start, stop, and remove the MYSQL service
  Start the MYSQL service: net start mysql
  Stop the MYSQL service: net stop mysql
  Remove the mysql service: mysqld -remove
Start the service here to facilitate the next step.
7
Modify the root password:
enter cmd during operation, jump to the installation directory /bin,
D:\wamp\mysql\bin>mysql -uroot
mysql>show databases; 
mysql>use mysql;
mysql>delete from User where User="" ;
mysql>update User set Password=PASSWORD('newpassword') where User='root';
mysql>FLUSH PRIVILEGES; 
mysql>quit;
FLUSH PRIVILEGES: Force MySQL to reload permissions, which will take effect immediately.
At this point , you can use the following command to log in:
D:\wamp\mysql\bin>mysql -uroot -p
ENTERPASSWORD:newpassword
8
8: Common command
mysql>show databases; show all tables
mysql>use mysql; switch to table mysql         
mysql>show tables; show the structure of the table
Note :
cmd should be run as an administrator
Enter mysql and enter the command ending with a semicolon


Multiple methods for MySQL to change the root password
mysql root
method 1: Use SET PASSWORD command
  mysql -u root
  mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('newpass');
Method 2: Use mysqladmin
  mysqladmin -u root password "newpass"
  If root has already set a password, use the following method
  mysqladmin -u root password oldpass "newpass"
Method 3: Edit user table
  mysql directly with UPDATE -u root
  mysql> use mysql;
  mysql> UPDATE user SET Password = PASSWORD('newpass') WHERE user = 'root';
  mysql> FLUSH PRIVILEGES ;
When you lose the root password, you can do this
  mysqld_safe --skip-grant-tables&
  mysql -u root mysql
  mysql> UPDATE user SET password=PASSWORD("new password") WHERE user='root';
  mysql> FLUSH PRIVILEGES;

MySql access denied for user error
Step read
Method/Step
1
The "access denied for user **@**" error in MySql remote connection caused me a lot of trouble, and I found out the solution later. Record it, for fear of forgetting it later:
2
First log in to MySQL locally, and then execute these two lines of code: GRANT ALL PRIVILEGES ON *.* TO root@'%' IDENTIFIED BY '000000';FLUSH PRIVILEGES;Format: grant permission on database name .Table name user@login host identified by "user password";
3
parameter description: ALL PRIVILEGES indicates the authority assigned to the remote login user, ALL PRIVILEGES indicates all authority, you can also assign select, update, insert, delete individually or in combination Permissions; *.*: The first * represents the name of the database to be empowered, * of course, represents all databases, and the second * represents the table name under the database. Similarly, * represents all tables, for a lazy person like me Of course, I use *.* directly, anyway, I use it for my own development
.
root means the user to be empowered; % means the remote login IP, if you want to restrict the login IP, add the IP you allow to log in here, such as 192.18.1.99, etc., % means no IP restriction (lazy again), 000000 is the user Password for remote login. It's that simple. After running this sentence, run FLUSH PRIVILEGES, and you're done!

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326924635&siteId=291194637