阿里云服务器新建用户_MySQL
阿里云
bitsCN.com阿里云服务器新建用户
本文包括了新建服务器用户和新建MySQL用户的方法:
一. 新建服务器用户:
用户管理,主要的工作就是建立一个合法的用户帐户、设置和管理用户的密码、修改用户帐户的属性以及在必要时删除已经废弃的用户帐号。
1)增加一个新用户
在Linux系统中,只有root用户才能够创建一个新用户,如下的命令将新建一个登录名user1的用户。
#useradd user1
但是,这个用户还不能够登录,因为还没给它设置初始密码,而没有密码的用户是不能够登录系统的。在默认情况下,将会在/home目录下新建一个与用户名相同的用户主目录。
在Linux中,新增一个用户的同时会创建一个新组,这个组与该用户同名,而这个用户就是该组的成员。如果你想让新的用户归属于一个已经存在的组,则可以使用如下命令:
#useradd -g usergroup1 user1
这样该用户就属于usergroup1组的一员了。而如果想让其再属于一个组usergroup2,那么使用:
#useradd -G usergroup2 user1
完成了这一操作后,你还应该使用passwd命令为其设置一个初始密码。
2)删除一个用户
删除用户,只需使用一个简单的命令“userdel用户名”即可。不过最好将它留在系统上的文件也删除掉,你可以使用“userdel-r用户名”来实现这一目的。
3)增加一个组
我们可以根据自己的需要创建用户组:
groupadd
4)删除一个组
同样的,我们有时会需要删除一个组,它的命令就是groupdel。
二. 安装mysql和创建mysql用户:
1.[root@test1 local]# yum -y install mysql mysql-server
这条命令同时安装了mysql客户端和mysql服务器端
2.测试是否成功可运行netstat看Mysql端口是否打开,如打开表示服务已经启动,安装成功。Mysql默认的端口是3306。
[root@test1 local]# netstat –nat
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN
上面显示可以看出MySQL服务已经启动。
3.登录MySQL的命令是mysql
第一次进时只需键入mysql即可。
[root@test1 local]# mysql
增加了密码后的登录格式如下:
mysql -u root -p
Enter password: (输入密码)
3.MySQL的几个重要的目录
1).数据库目录
/var/lib/mysql/
2).配置文件
/usr/share/mysql(mysql.server命令及配置文件)
3)相关命令
/usr/bin(mysqladmin mysqldump等命令)
4)启动脚本
/etc/rc.d/init.d/(启动脚本文件mysqld的目录)
4.修改登录密码
1)命令
usr/bin/mysqladmin -u root password ‘new-password’
格式:mysqladmin -u用户名 -p旧密码 password 新密码
2)例子
例1:给root加个密码123456。
键入以下命令 :
[root@test1 local]# /usr/bin/mysqladmin -u root password 123456
注:因为开始时root没有密码,所以-p旧密码一项就可以省略了。
3)测试是否修改成功
不用密码登录
[root@test1 local]# mysql
ERROR 1045: Access denied for user: ‘root@localhost’ (Using password: NO)
显示错误,说明密码已经修改。
用修改后的密码登录
[root@test1 local]# mysql -u root -p
Enter password: (输入修改后的密码123456)
Welcome to the MySQL monitor. Commands end with ; or /g.
Your MySQL connection id is 4 to server version: 4.0.16-standard
Type ‘help;’ or ‘/h’ for help. Type ‘/c’ to clear the buffer.
mysql>
成功!
这是通过mysqladmin命令修改口令,也可通过修改库来更改口令。
5.增加MySQL用户
grant all on *.* to 'xhx'@'%' Identified by '123456';
以上grant权限之后的用户就可以通过网上的任何一台电脑上登录你的MySQL数据库并对你的数据为所欲为了。
bitsCN.com
Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

With the rapid development of social media, Xiaohongshu has become one of the most popular social platforms. Users can create a Xiaohongshu account to show their personal identity and communicate and interact with other users. If you need to find a user’s Xiaohongshu number, you can follow these simple steps. 1. How to use Xiaohongshu account to find users? 1. Open the Xiaohongshu APP, click the "Discover" button in the lower right corner, and then select the "Notes" option. 2. In the note list, find the note posted by the user you want to find. Click to enter the note details page. 3. On the note details page, click the "Follow" button below the user's avatar to enter the user's personal homepage. 4. In the upper right corner of the user's personal homepage, click the three-dot button and select "Personal Information"

When using Win11 system, sometimes you will encounter a prompt that requires you to enter the administrator username and password. This article will discuss how to deal with this situation. Method 1: 1. Click [Windows Logo], then press [Shift+Restart] to enter safe mode; or enter safe mode this way: click the Start menu and select Settings. Select "Update and Security"; select "Restart Now" in "Recovery"; after restarting and entering the options, select - Troubleshoot - Advanced Options - Startup Settings -&mdash

In Ubuntu systems, the root user is usually disabled. To activate the root user, you can use the passwd command to set a password and then use the su- command to log in as root. The root user is a user with unrestricted system administrative rights. He has permissions to access and modify files, user management, software installation and removal, and system configuration changes. There are obvious differences between the root user and ordinary users. The root user has the highest authority and broader control rights in the system. The root user can execute important system commands and edit system files, which ordinary users cannot do. In this guide, I'll explore the Ubuntu root user, how to log in as root, and how it differs from a normal user. Notice

According to news from this website on August 5, Alibaba Cloud announced that the 2024 Yunqi Conference will be held in Yunqi Town, Hangzhou from September 19th to 21st. There will be a three-day main forum, 400 sub-forums and parallel topics, as well as nearly four Ten thousand square meters of exhibition area. Yunqi Conference is free and open to the public. From now on, the public can apply for free tickets through the official website of Yunqi Conference. An all-pass ticket of 5,000 yuan can be purchased. The ticket website is attached on this website: https://yunqi.aliyun.com/2024 /ticket-list According to reports, the Yunqi Conference originated in 2009 and was originally named the First China Website Development Forum. In 2011, it evolved into the Alibaba Cloud Developer Conference. In 2015, it was officially renamed the "Yunqi Conference" and has continued to successful move

Wireless networks have become an indispensable part of people's lives in today's digital world. Protecting the security of personal wireless networks is particularly important, however. Setting a strong password is key to ensuring that your WiFi network cannot be hacked by others. To ensure your network security, this article will introduce in detail how to use your mobile phone to change the router WiFi password. 1. Open the router management page - Open the router management page in the mobile browser and enter the router's default IP address. 2. Enter the administrator username and password - To gain access, enter the correct administrator username and password in the login page. 3. Navigate to the wireless settings page - find and click to enter the wireless settings page, in the router management page. 4. Find the current Wi

Wireless networks have become an indispensable part of our lives with the rapid development of the Internet. In order to protect personal information and network security, it is very important to change your wifi password regularly, however. To help you better protect your home network security, this article will introduce you to a detailed tutorial on how to use your mobile phone to change your WiFi password. 1. Understand the importance of WiFi passwords. WiFi passwords are the first line of defense to protect personal information and network security. In the Internet age, understanding its importance can better understand why passwords need to be changed regularly. 2. Confirm that the phone is connected to wifi. First, make sure that the phone is connected to the wifi network whose password you want to change before changing the wifi password. 3. Open the phone’s settings menu and enter the phone’s settings menu.

In network data transmission, IP proxy servers play an important role, helping users hide their real IP addresses, protect privacy, and improve access speeds. In this article, we will introduce the best practice guide on how to build an IP proxy server with PHP and provide specific code examples. What is an IP proxy server? An IP proxy server is an intermediate server located between the user and the target server. It acts as a transfer station between the user and the target server, forwarding the user's requests and responses. By using an IP proxy server

This article will explore how to solve the problem of wrong password, especially the need to be careful when dealing with BitLocker warnings. This warning is triggered when an incorrect password is entered multiple times in BitLocker to unlock the drive. Usually, this warning occurs because the system has a policy that limits incorrect login attempts (usually three login attempts are allowed). In this case, the user will receive an appropriate warning message. The complete warning message is as follows: The password entered is incorrect. Please note that continuously entering incorrect passwords will cause the account to be locked. This is to protect the security of your data. If you need to unlock your account, you will need to use a BitLocker recovery key. The password is incorrect, beware the BitLocker warning you receive when you log in to your computer
