我正在尝试安装和配置mysql和phpmyadmin,但是在安装mysql-server之后,当我尝试使用mysql_secure_installation终端命令时,请我输入root密码。输入后,显示错误:
import java.util.Scanner;
public class Project {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
char operation;
int num1, num2;
//Asks for user to input first number
System.out.println("Please enter the first number (0-9)");
num1 = input.nextInt();
//Asks user for an operation
System.out.println("Please enter the type of operation that you would like to perform");
operation = input.next().charAt(0);
//Asks user to input the second number
System.out.println("Please enter the second number (0-9)");
num2 = input.nextInt();
//Limits the numbers to the range of 0-9
if(num1 > 9 || num2 > 9){
System.out.println("Invalid Digit!!");
System.exit(0);}
//An array that converts number into a string
String num[] = {"zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"};
switch(operation){
case '-': //Subtraction conversion
System.out.println(num[num1]+" minus "+num[num2] + " is " + (num1-num2));
System.out.println(num1+" "+operation + " "+num2+ " = "+(num1 - num2));
break;
case '+': //Addition conversion
System.out.println(num[num1]+" plus "+num[num2] + " is " + (num1+num2));
System.out.println(num1+" "+operation + " "+num2+ " = "+(num1 + num2));
break;
case '*': //Multipication conversion
System.out.println(num[num1]+" multiplied by "+num[num2] + " is " + (num1*num2));
System.out.println(num1+" "+operation + " "+num2+ " = "+(num1 * num2));
break;
case '/': //Division conversion
System.out.println(num[num1]+" divided by "+num[num2] + " is " + (num1/num2));
System.out.println(num1+" "+operation + " "+num2+ " = "+(num1 / num2));
break;
case '^': //Exponentiation conversion
if(num2 == 0){ //checks to see if the second number entered is 0
System.out.println("Error: Cannot divide by Zero"); //Divide by Zero error message
break;}
System.out.println(num[num1]+" to the power of "+num[num2] + " is " + Math.pow(num1,num2));
System.out.println(num1+" "+operation + " "+num2+ " = "+(Math.pow(num1,num2)));
break;
default:
System.out.println("Error: Invalid Operation Entered"); }
}
}
我尝试使用此页面https://kifarunix.com/install-mysql-8-on-ubuntu-20-04/
中的信息安装mysql编辑: https://www.hivelocity.net/kb/what-to-do-if-mysql-sock-file-is-missing/没帮助