(16)、在打开的页面中设置是否要修改默认root用户(超级管理员)的密码(默认为空),“New root password”,如果要修改,就在此填入新密码,并启用root远程访问的功能,不要创建匿名用户,单击“next”继续配置,如图所示:
(17)、到这里所有的配置操作都已经完成,单击Execute按钮执行配置,如图所示:
(18)、过了几分钟,出现如下的提示界面就代表MySQL配置已经结束了,并提示了成功的信息。
(19)、在服务中将mysql数据库启动,并在命令窗口中输入“mysql –h localhost –u root -p”,接着在出现的提示中输入用户的密码,如图所示:
从图中可以看到mysql数据库在启动之后,成功的登录了,在此我们可以对数据库进行操作了。
7. 下载安装数据库可视化工具Navicat for MySQL
Navicat是数据库的可视化工具,Navicat for MySQL一套专为 MySQL 设计的
高性能数据库管理及开发工具。通过它的图形化界面,我们可以很清楚的查看数据的存储信息,并可以做事务操作。
8. 实现手机端读取NFC标签信息。 (1)创建第一个Android应用程序
启动Eclipse,选择菜单File|New|Project 选择other ,展开Android文件夹,选择Android Application Project
下一步:输入你创建的工程名字,然后一直默认点击下一步,最后点击完成。 至此,你的第一个Android程序创建完成。要运行你的项目时,右键点击你的项目名,选择 run as|Android Application,选择你想将此项目部署的目标设备上,即可完成部署启动。
(2)创建NFC读取的应用程序
按照上一步做的,创建一个新的Android程序
2.1) 在res|layout|下打开.xml布局文件,布局你的App主界面 界面布局文件如下:
android:layout_height=\ android:orientation=\ android:id=\ android:layout_width=\ android:layout_height=\ android:gravity=\ android:text=\请将标签靠近手机背面\ android:textSize=\ android:layout_width=\ android:layout_height=\ android:background=\ android:id=\ android:layout_width=\ android:layout_height=\ android:text=\读取标签ID号:\ android:layout_width=\ android:layout_height=\ android:background=\ android:id=\ android:layout_width=\ android:layout_height=\ android:gravity=\ android:text=\标签类型信息\
2.2) 在scr下部署文件,找到你刚才创建的.java文件。scr文件下共有两个包:
其中com.example.nfc_lab包下的NFC_lab.java文件代码如下:
package com.example.nfc_lab; import java.io.IOException;
import com.jph.sdg.service.SendDateToServer; import android.app.Activity;
import android.app.PendingIntent; import android.content.Intent;
import android.content.IntentFilter;
import android.content.IntentFilter.MalformedMimeTypeException; import android.nfc.NfcAdapter; import android.nfc.Tag;
import android.nfc.tech.MifareClassic; import android.nfc.tech.NfcA; import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.util.Log; import android.view.View;
import android.view.View.OnClickListener; import android.widget.Button; import android.widget.TextView; import android.widget.Toast;
public class NFC_lab extends Activity { private NfcAdapter nfcAdapter; private TextView tv1,tv2,tv3; private PendingIntent mPendingIntent; private IntentFilter[] mFilters; private String[][] mTechLists; private String info=\ private int mCount=0; Handler handler=new Handler(){ public void handleMessage(Message msg) { switch (msg.what) { case SendDateToServer.SEND_SUCCESS: break; case SendDateToServer.SEND_FAIL: break; default: break; } }; }; private Button btnSend;