In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
How do I install MySQL in a Ubuntu18.04 environment? I believe that many inexperienced people are at a loss about this, so this article summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.
Installation
Mysql
Sudo apt-get-- purge remove mysql-server mysql-common mysql-clientsudo apt-get install mysql-server mysql-common mysql-clientmysqladmin-u root password your-new-passwordsudo / etc/init.d/mysql restart
Mariadb
Apt-get install mariadb-server
Character set modification utf8
If you install mariadb, the default character set is already utf8. Mysql is not.
Mysql > show variables like 'char%' +-- +-- + | Variable_name | Value | + -+ | character_set_client | utf8 | | character_set_connection | utf8 | | character_set_database | latin1 | | character_set_filesystem | binary | | character_set_results | utf8 | | character_set_server | latin1 | | character_set_system | utf8 | | character_sets_dir | / usr/share/mysql/charsets/ | +-- -+-+ mysql > show variables like 'collation%' +-- +-+ | Variable_name | Value | +-+-+ | collation_connection | utf8_general_ci | | collation_database | latin1_swedish_ci | | collation_server | | latin1_swedish_ci | +-+-+ |
Modify the character set:
Sudo vim / etc/mysql/my.cnf
Add the following
[mysqld] collation-server = utf8_unicode_ciinit-connect='SET NAMES utf8'character-set-server = utf8
Restart:
Service mysql restart
Login permission problem
After Ubuntu18.04 installs mysql or mariadb, it is found that ordinary users and remote users do not have permission to connect.
ERROR 1045: Access denied for user: 'root@localhost' (Using
Password: YES)
It's not right to change the password. Then sudo mysql-u root can log in. This is obviously not what we want.
Solution
Delete the root and recreate the user.
First, log in
Sudo mysql-u root
Then view the current user
SELECT User,Host FROM mysql.user;+-+-+ | User | Host | +-+-+ | admin | localhost | | debian-sys-maint | localhost | | magento_user | localhost | mysql.sys | localhost | | root | localhost |
Delete root account
Mysql > DROP USER 'root'@'localhost';Query OK, 0 rows affected (0penny 00 sec)
Recreate the root:
Mysql > CREATE USER 'root'@'%' IDENTIFIED BY' 123456 question question OK, 0 rows affected (0jue 00 sec)
Authorization
Mysql > GRANT ALL PRIVILEGES ON *. * TO 'root'@'%' WITH GRANT OPTION;Query OK, 0 rows affected (0mem00 sec) mysql > FLUSH PRIVILEGES;Query OK, 0 rows affected (0mem01 sec)
About resetting password
Allow remote login when host is%
SET PASSWORD FOR root@'localhost' = PASSWORD ('password')
Or
UPDATE mysql.user SET Password=PASSWORD ('newpwd') WHERE User='root'
Or
USE mysqlUPDATE user SET Password = PASSWORD ('newpwd') WHERE Host =' localhost' AND User = 'root'
Allow login from anywhere
USE mysqlUPDATE user SET Password = PASSWORD ('newpwd') WHERE Host ='% 'AND User =' root'; after reading the above, do you know how to install MySQL in the Ubuntu18.04 environment? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!
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.