This article conducts a study on data security risks and laws in the era of AI. In the development of AI, the lifecycle of data, especially data security protection, is a key concern. The AI data security brain utilizes billions of intelligent terminals to collect data and information, and through intelligent analysis, perceives security risks; Possess the ability to self-learning and self-evolution to identify new threats. In order to promote data empowerment, ensure data security during the development of AI and ensure the driving role of data in the development of the digital economy. Establishing the Basic Law on Maintaining Data Security requires the establishment of basic principles of data security, the regulation of basic maintenance systems, and the formulation of core content for maintaining data security. And reduce the query security risks faced by the data to the smallest possible extent, thereby ensuring the legitimate and reliable query of the data. Data security issues have become prominent, and China has accelerated legislation to protect data security in the development of AI at the legal level.