Ubuntu using MySQL Workbench to connect to remote cloud server MySQL

1. Create a new user

For general safety, we do not directly use the root user, choosing instead to create a new user.

In the server, enter mysql -u root -p, go mysql,

Then enter the following command to create a user

GRANT ALL ON *.* to user@'ip' IDENTIFIED BY 'pwd';

There is no knowledge about the rights mentioned here,

user is the user name you want to create

ip address is accessed,% represents remote access, localhost is local access, also can be specific to a particular ip address, we use here is%

pwd is the password you want to create

User created above all is to have a user permission, can be understood as second only to the root user is the administrator.

 

After you have created can refresh authority table

FLUSH PRIVILEGES;

Refresh can not, because we can restart mysql.

sudo /etc/init.d/mysql restart

2. Turn on remote access

Because mysql remote access is disabled by default, so we need to change it.

sudo vim /etc/mysql/mysql.conf.d/mysqld.conf

This configuration file is our ubuntu, including modifying the character set is changed in this file inside. Modify the character set

We find this file inside bind-address = 127.0.0.1

Then commented on it

# By default we only accept connections localhost from
under # official translation is by default, we only accept connections from the local host
# bind-address = 127.0.0.1

3. Using MySQL WorkBench

Then you can be friends!

Linux (Ubuntu) system mysql-5.7 modify the character set

Cause: When I see the article mysql modify the character of the Internet, said the configuration file /etc/mysql/my.cnf

But when I open my my.cnf file above, to find that the content is not the same with others, I think this is certainly not the correct file

After my studies in the official website and found the real file

it is this

/etc/mysql/mysql.conf.d/mysqld.cnf

At least on my local computer and the cloud servers are, or, according to my mysql database Bowen are installed above file

Then we edit the file above, find the [mysqld] add the following:

character-set-server =utf8

Then restart the service

sudo /etc/init.d/mysql restart

Log in to see go mysql

msql > show variables like 'character%';

Ok.

Guess you like

Origin www.linuxidc.com/Linux/2019-07/159619.htm