Mysql> show variables like 'character % ';The following figure is displayed:
+ -------------------------- + ---------------------------------------- +
| Variable_name | Value |
+ -------------------------- + ---------------------------------------- +
| Character_set_client | utf8 |
| Character_set_connection | utf8 |
| Character_set_database | utf8 |
| Character_set_filesystem | binary |
| Character_set_results | utf8 |
| Character_set_server | utf8 |
| Character_set_system | utf8 |
| Character_sets_dir |/usr/local/mysql/share/mysql/charsets/|
+ -------------------------- + ---------------------------------------- +
Okay. The database language is complete.
▲Enable mysql Remote Access
Mysql does not allow remote access by default.
If you log on to mysql with a password, you can log on normally. However, if you use a tool to connect to another machine, an error is returned:
ERROR 1130: Host 192.168.1.6 is not allowed to connect to this MySQL server
Method: Change the table method. By default, mysql does not allow remote access and can only be accessed on localhost. At this time, you only need to log on to the computer of localhost. After logging on to mysql, change the "host" item in the "user" table in the "mysql" database to "%" from "localhost"
Mysql-u root-p
Enter password: chang
Mysql> use mysql;
Mysql> update user set host = '%' where user = 'root'; // an error may occur.
Mysql> flush privileges;
Mysql> select host, user from user where user = 'root ';
After executing the preceding command, you can connect to the instance remotely!
Note:
Update user set host = '%' where user = 'root'; // an error may be returned when this command is executed:
ERROR 1062 (23000): Duplicate entry '%-root' for key 1;
Solution:
1. Don't worry about it. Haha.
2. Run the command in this way.
Update user set host = '%' where user = 'root' and host = 'localhost ';
That is, change localhost to all hosts.
---------------------------------------------------
Then run the app and report the following error:
ImportError: libmysqlclient_r.so.15: cannot open shared object file: No such file or directory
The solution is to put/usr/local/mysql/lib under
Libmysqlclient_r.so.15
Copy to/usr/lib.
So far, mysql installation and configuration are complete!
======================== I am a gorgeous splitting line ================================ ======
----------------------------------------------------
■ Note:
Note 1: restart and disable the mysql Service
Restart mysql Service
: $ Sudo/etc/init. d/mysql restart
Disable mysql Service
: $ Sudo/etc/init. d/mysql stop
----------------------------------------------------
NOTE 2: Start and Stop mysql in non-service status
Start mysql
Code:
: & Cd/usr/local/mysql
: & Bin/mysqld_safe -- basedir =/usr/local/mysql -- user = mysql &
Stop mysql
Code:
: & Cd/usr/local/mysql
: $ Bin/mysqladmin-uroot-ppassw0rd shutdown
----------------------------------------------------
NOTE 3: What is the mysql command line display in Chinese? No.
Mysql> set names utf8;
---------------------------------------------------
Note 4: mysql database storage path
/Var/lib/mysql
---------------------------------------------------
Note 5: export and import data from mysql
Mysqldump Database Name> file name # Export Database
Mysqladmin create database name # create database
Mysql database name <file name # import database
---------------------------------------------------
Note 6: Modify the root password of mysql
Sudo mysqladmin-u root-p password 'your new password'
Or, the new password is in brackets.
Use mysql;
Update user set Password = password ('Chang') where User = 'root ';
Flush privileges;
---------------------------------------------------
Note 7: What should I do if I forget the mysql root Password?
Sudo/etc/init. d/mysql stop
Sudo mysqld_safe -- skip-grant-tables &
Sudo mysqladmin-u user password 'newpassword
Sudo mysqladmin flush-privileges
---------------------------------------------------
Note 8: Enter the mysql host to log on.
./Mysql-u root-h 127.0.0.1-p
Perform Security Settings
# Bin/mysql_secure_installationNOTE: running all parts of this script is recommended for all MySQL servers in production use! Please read each step carefully! In order to log into MySQL to secure it, we'll need the currentpassword for the root user. if you 've just installed MySQL, andyou haven' t set the root password yet, the password will be blank, so you shoshould just press enter here. enter current password for root (enter for none): <--- Enter the current root password, because we have not set it yet. Press enter OK, successfully used password, moving on... setting the root password ensures that nobody ca N log into the MySQLroot user without the proper authorisation. Set root password? [Y/n] Y <--- whether to set the root password. Of course, enter Y and press enter New password: <--- enter the root password, and press Enter, re-enter new password: <--- enter the root Password again and press enter. During the input process, no password updated successfully is displayed! Reloading privilege tables... Success! By default, a MySQL installation has an anonymous user, allowing anyoneto log into MySQL without having to have a user account created forthem. this is intended only for testing, and to make the installationgo a bit smoother. you shoshould remove them before moving into aproduction environment. remove anonymous users? [Y/n] Y <--- whether to delete anonymous users. Delete the user. Enter Y and press enter... Success! Normally, root shoshould only be allowed to connect from 'localhost'. Thisensures that someone cannot guess at the root password from the network. Disallow root login remotely? [Y/n] Y <--- whether to delete or disable remote logon by the root user. Of course, disable remote logon by entering Y and press enter... Success! By default, MySQL comes with a database named 'test' that anyone canaccess. this is also intended only for testing, and shocould be removedbefore moving into a production environment. remove test database and access to it? [Y/n] <--- whether to delete the test database, delete it, and press Y to enter-Dropping test database... Success! -Removing privileges on test database ...... Success! Reloading the privilege tables will ensure that all changes made so farwill take effect immediately. Reload privilege tables now? [Y/n] Y <--- refresh permission, enter Y and press enter... Success! Cleaning up... All done! If you 've completed all of the above steps, your MySQLinstallation shoshould now be secure. Thanks for using MySQL!