In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly explains "the installation and remote connection configuration of MySQL under Ubuntu". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Now let the editor take you to learn "the installation and remote connection configuration of MySQL under Ubuntu".
1. Installation of MySQL under ubuntu
Type sudo apt-get install mysql-server under the ubuntu command line to install the mysql service. By default, mysql-client will be installed automatically when you install mysql-server.
The location of the mysql configuration file installed at the same time: / etc/mysql/my.cnf
The shortcut icon to start mysql is: / etc/init.d/mysql
Second, the solution to the coding problem
View the current MYSQL character set [execute in mysql command line mode]: show variables like 'character%'
Change the code: sudo vim / etc/mysql/my.cnf
Find [client] and add the following two sentences:
/ / the default character set is utf8
Default-character-set=utf8
Find [mysqld] and add the following four sentences: (note that there can be no spaces before and after each line)
/ / the default character set is utf8
Default-character-set=utf8
/ / set to use utf8 encoding when connecting to mysql to make the database run for utf8
Init_connect='SET NAMES utf8'
Finally, switch to the last line mode of vim and execute wq to exit the vim editor.
Stop the database service: sudo / etc/init.d/mysql stop
Restart: s udo / etc/init.d/mysql start
Access the database: mysql-uroot-p (your password)
View the code: show variables like'% character%'
At this point, it should be all utf8 coding.
3. MySQL service joins boot self-startup
Join Boot self-booting: sudo update-rc.d mysql defaults
Remove from boot-up: sudo update-rc.d-f mysql remove
4. Remote connection to MySQL under ubuntu
Vim / etc/mysql/my.cnf found
Bind-address = 127.0.0.1
Comment out this line (as below)
# bind-address = 127.0.0.1
Or change it to
Bind-address = 0.0.0.0
Allow arbitrary IP access, or specify an IP address yourself.
Then restart MySQL
Sudo / etc/init.d/mysql restart
Authorized users can connect remotely
Grant all privileges on *. * to root@ "%" identified by "password" with grant option
Flush privileges
The first line of the command is explained as follows. *. *: the first * represents the database name; the second * represents the table name. This means that all tables in all databases are authorized to the user. Root: the root account is granted. "%": the authorized user IP can be specified, which means that any IP address can access the MySQL database. "password": assign the password corresponding to the account, where the password is replaced with your mysql root account password.
The second line of command is to refresh the permission information, that is, to make our settings take effect immediately.
At this point, the MySQL under the remote connection ubuntu should be able to connect.
At this point, I believe you have a deeper understanding of the "installation and remote connection configuration of MySQL under Ubuntu". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.