[SQL]Ubuntu安装mysql并复习SQL语句
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了[SQL]Ubuntu安装mysql并复习SQL语句,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含2342字,纯文字阅读大概需要4分钟。
内容图文
![[SQL]Ubuntu安装mysql并复习SQL语句](/upload/InfoBanner/zyjiaocheng/895/5231e3ad882840eea273598a82c9e8db.jpg)
1.安装MySql:
sudo apt update sudo apt upgrade -y sudo apt install mysql-server -y
2.配置MySQL:
#配置密码 和 安全策略 可以无脑按Y sudo mysql_secure_installation ---- Securing the MySQL server deployment. Connecting to MySQL using a blank password. VALIDATE PASSWORD PLUGIN can be used to test passwords and improve security. It checks the strength of password and allows the users to set only those passwords which are secure enough. Would you like to setup VALIDATE PASSWORD plugin? Press y|Y for Yes, any other key for No: N Please set the password for root here. New password: Re-enter new password: By default, a MySQL installation has an anonymous user, allowing anyone to log into MySQL without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment. Remove anonymous users? (Press y|Y for Yes, any other key for No) : Y Success. Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network. Disallow root login remotely? (Press y|Y for Yes, any other key for No) : Y Success. By default, MySQL comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment. Remove test database and access to it? (Press y|Y for Yes, any other key for No) : Y - Dropping test database... Success. - Removing privileges on test database... Success. Reloading the privilege tables will ensure that all changes made so far will take effect immediately. Reload privilege tables now? (Press y|Y for Yes, any other key for No) : Y Success. All done!
检查服务:
alfred@vm:~$ sudo systemctl status mysql ● mysql.service - MySQL Community Server Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled) Active: active (running) since Tue 2019-08-20 19:11:32 PDT; 4min 38s ago Main PID: 19856 (mysqld) Tasks: 29 (limit: 4915) CGroup: /system.slice/mysql.service └─19856 /usr/sbin/mysqld --daemonize --pid-file=/run/mysqld/mysqld.pid Aug 20 19:11:32 vm systemd[1]: Starting MySQL Community Server... Aug 20 19:11:32 vm systemd[1]: Started MySQL Community Server.
连接数据库:
sudo mysql -uroot -p 使用上面初始化的密码登录
3.使用SQL
检查所有表:
4.常用语句:
内容总结
以上是互联网集市为您收集整理的[SQL]Ubuntu安装mysql并复习SQL语句全部内容,希望文章能够帮你解决[SQL]Ubuntu安装mysql并复习SQL语句所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。