我使用MySQL已有好几年了,创建新用户的命令直到MySQL 5.x版本如下:
GRANT ALL PRIVILEGES ON *.* TO 'username'@'localhost' IDENTIFIED BY 'password';
Run Code Online (Sandbox Code Playgroud)
最近我安装了MySQL 8.在那,这个命令不起作用.
在触发上述命令时抛出以下错误:
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IDENTIFIED BY 'password'' at line 1
Run Code Online (Sandbox Code Playgroud)
MySQL 8中的语法有什么变化吗?在MySQL 8中创建新用户命令的正确语法是什么?
注意:我在MySQL 5.x版本中尝试了这种语法.它正常工作.
我有这个类构造函数:
public Category(int max){
...
}
Run Code Online (Sandbox Code Playgroud)
问题是,我想创建这个类的数组,我该如何初始化它?
private Category categories = new Category(max)[4];
Run Code Online (Sandbox Code Playgroud)
不行.
UPDATE
我需要做这样的事情吗?
private Category[] categories = new Category[4];
Run Code Online (Sandbox Code Playgroud)
然后初始化每个对象?
在春季启动每当文件在classpath改变,应用程序中使用弹簧引导devtools将导致应用程序重新启动.有些也可以使用JRebel实现,但JRebel不是免费的.
我在dropwizard中寻找相同的功能.Springboot中是否有任何免费工具或任何类似devtools的库可以在dropwizard中实现?
我是Android新手.我想水平放置4个按钮,左右两侧边距相等,如下面的线框图所示:
我在Google和Stackoverflow上搜索了很多.我试着设置android:layout_weight ="1".但它只从左侧设定相同的余量.我想在两侧和多个屏幕布局上设置它.我想知道应该为此应用哪些布局和属性.我在Android工作室使用,大多使用拖放方法进行设计.
目前我的XML布局如下:
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/frameLayout"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginTop="10dp"
android:id="@+id/relativeLayout">
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="3"
android:id="@+id/b3"
android:layout_gravity="left|center_vertical"
android:onClick="buttonThree"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="false"
android:layout_alignParentStart="true"
android:layout_alignParentRight="false"
android:layout_weight="1"
android:width="0dp" />
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="5"
android:id="@+id/b5"
android:layout_gravity="left|center_vertical"
android:onClick="buttonFive"
android:layout_alignParentTop="true"
android:layout_toRightOf="@+id/b3"
android:layout_toEndOf="@+id/b3"
android:layout_alignParentRight="false"
android:layout_alignParentLeft="false"
android:layout_weight="1"
android:width="0dp"
android:layout_alignParentBottom="false" />
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="7"
android:id="@+id/b7"
android:layout_gravity="left|center_vertical"
android:onClick="buttonSeven"
android:layout_alignParentTop="true"
android:layout_toRightOf="@+id/b5"
android:layout_toEndOf="@+id/b5"
android:layout_alignParentRight="false"
android:layout_weight="1"
android:width="0dp" />
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="9"
android:id="@+id/b9"
android:layout_gravity="left|center_vertical"
android:onClick="buttonNine"
android:layout_alignParentTop="true"
android:layout_toRightOf="@+id/b7"
android:layout_toEndOf="@+id/b7"
android:layout_alignParentRight="false"
android:layout_weight="1"
android:width="0dp" />
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud) 我只是用一小段大代码来解释我的问题:
class A
{
B b= new B();
B z;
void xyz(){
if(// condition to check z is not assigned instance of class B){
z=b;
}
else{
z= new B();
}
}
}
class B{
//variables and methods
}
Run Code Online (Sandbox Code Playgroud)
我想要一个表达式,如果xyz()的块检查天气对象z已经分配了一个B的实例,我在if块的括号中做了评论.或以其他方式.
什么是检查天气的方法任何java对象都有他们的类的实例?